Let $M^{n-1} \subset \mathbb{R}^n$ be a smooth compact manifold, $\Lambda$ = $\{U_i\}_{i \in I}$ be an open cover of $\mathbb{R}^n$. Suppose that for every $U_i$ there is a smooth bounded function $f_i : U_i \rightarrow [-1,1]$, such that, for every $i \neq j$, occurs only one of the following conditions:
- $f_i(x) = f_j(x)$, $\forall$ $x$ $\in$ $U_i \cap U_j,$
- $f_i(x) = -f_j(x)$, $\forall$ $x$ $\in$ $U_i \cap U_j.$
Besides that $f_i(x) = 0$ $\Leftrightarrow$ $x \in M\cap U_i$.
For $x_0$ $\in$ $\mathbb{R}^n \setminus \{0\}$, we will define a function $f_{x_0}:\mathbb{R}^n \rightarrow [-1,1]$ as following:
Consider $x$ $\in$ $\mathbb{R}^n$, let $\gamma_x:[0,1] \to \mathbb{R}^n$ be a continious path linking $x_0$ to $x$. Note that we can subdivide $[0,1]$ in $0=t_0\leq t_1 \leq t_2 \leq \ldots \leq t_n =1$, in such way that $\gamma_x([t_i,t_{i+1}]) \subset U_{j_i}$, for some $U_{j_i}$ $\in$ $\Lambda$. Suppose, without loss of generality, that $U_{j_i} = U_i$, for every $i$ $\in$ $\{0,1,...,n\}$.
For every $i$ $\in$ $\{0,...,n\}$ there is $\xi_i$ $\in$ $U_{i-1} \cap U_{i}$, such that, $f_{i}(\xi_i) \neq 0.$
Defining $g_i:U_i \rightarrow [-1,1]$ recursively as
- $g_{0}(x)$ $=$ $f_{0}(x)$,
- $g_i (x)= \frac{f_i(\xi_i)}{g_{i-1}(\xi_{i})} \cdot f_i(x)$, $\forall$ $i$ $\in\{1,...,m\}$.
Finally we say that $f_{x_0}(x) = g_n(x)$, for $x \in U_n$.
My Doubt: Why $f_{x_0}$ does not depends on the path $\gamma_x$ used to define $f_{x_0} (x)$?
I think the function $f$ is well defined because $\mathbb{R}^{n}$ is a simply connected, but I don't know how to demonstrate that the construction of the value $f_{x_0}(x)$ is invariant under homotopy.
Let us consider the following setting: $X$ is a topological space and $\Gamma$ is a collection of pairs $(U,f)$, where $U\subset X$ is open and $f\colon U\rightarrow [-1,1]$ is continuous. Further assume:
1) If $(U,f)\in \Gamma$, then also $(U,-f)\in \Gamma$.
2) If $(U,f),(V,g)\in \Gamma$ with $U\cap V \neq \emptyset$, then either $fg\ge 0$ or $fg\le0$ on $U\cap V$ but not both.
3) For all $x\in X$ there is a $(U,f) \in \Gamma$ with $x\in U$.
Lemma. If $X$ is simply connected*, then there is a continuous map $F:X\rightarrow [-1,1]$ such that for each $(U,f)\in \Gamma$ we have either $F=f$ or $F=-f$ on $U$.
(*Maybe we need some other technical assumptions like locally path-connectedness. But $X=\mathbb{R}^n$ is definitely allowed.)
This Lemma solves your problem: First note that in your case you can take $X=\mathbb{R}^n$ and $\Gamma=\{(U_i,f_i),(U_i,-f_i)\vert i \in I\}$. Then 1)-3) are automatically satisfied. The submanifold $M$ only enters in the 'but not both' of condition 2). Assuming wlog that $F(x_0)=f_0(x_0)$, the function $f_{x_0}$ constructed above automatically coincides with $F$ (Irrespective of the chosen paths).
Proof. For $x\in X$ consider the set $A_x=\{(U,f)\vert x\in U\}$. Define an equivalence relation $\sim$ on $A_x$ by saying that $(U,f)\sim(V,g)$ iff $fg\ge 0 $ on $U\cap V$. Then let $E_x=A_x/\sim$ the set of equivalence classes (I.e. $E_x$ has two elements.).
Define $E=\coprod_{x\in X} E_x$ (as a set) and $p\colon E\rightarrow X$ by $p(a)=x$ if $a\in E_x$.
Let's define a topology on $E$ as follows: Say that $O\subset E$ is open, if and only if $p(O\cap p^{-1}(U))\subset X$ is open for all $(U,f)\in \Gamma$. Then $p$ automatically becomes continuous.
Further $p:E\rightarrow X$ is a covering space: Given $x\in X$, there is an $(U,f)\in \Gamma$ with $x\in U$ and we claim that $U$ is evenly covered. To this end define $s_1,s_2: U \rightarrow E$ by $s_1(x)=[(U,f)]\in E_x$ and $s_2(x) = [(U,-f)]\in E_x$. Check that both functions are continuous and satisfy $p\circ s_i = \mathrm{id}_U$ and $s_i\circ p = \mathrm{id}_{s_i(U)}$ ($i=1,2$).
Now, since $X$ is simply connected, it only has trivial covering spaces. In particular there is a global section of $p$, i.e. a continuous function $s:X\rightarrow E$ with $p\circ s(x) = x$ for all $x\in X$.
We can use $s$ to define $F$: Given $x\in X$, take $(U,f)\in s(x) \in E_x$ and put $F(x) = f(x)$.