Say we have a closed subset $F$ of a manifold $X$ (paracompact), $f\colon F \to \mathbb{R}$, such that there exists $U_i$ family of open subsets covering $F$ and $f_i$ smooth functions on $U_i$ such that $f_i\ _{|U_i\cap F}= f_{|U_i\cap F}$ ( $f$ is locally restriction of a smooth function on $X$).
Consider the cover $U_i, U_0=X\backslash F$ of $X$. There exists a partition of unity associated to this cover, that is $\phi_i$, $\phi_0$ with $\operatorname{supp} \phi_l \subset U_l$, $\operatorname{supp} \phi_l$ locally finite, and $\sum \phi_l=1$. The function $\phi_i f_i$ can be extended to a smooth function on $X$, defined by $\phi_i f_i$ on $U_i$ and by $0$ on $X \backslash \operatorname{supp}\phi_i$. Let $F = \sum_i \phi_i f_i$. Consider $x \in F$. Let $i_1$,$\ldots$, $i_k$ the finitely many indexes for which $\phi_l(x) \ne 0$. They are not $0$. Therefore, $x \in U_{i_s}$, $s=1,\ldots, k$, and $f_{i_s}(x) = f(x)$. We have $F(x) = \sum_{s} \phi_{i_s} f(x) =f(x)$.
Note: Why did we need $F$ closed? Otherwise we would have gotten a smooth extension only on an open neighborhood of the set.