Theorem 8.15 in Rudin PMA - Proof Explanation 
Theorem 8.15: If $f$ is a continuous and $2\pi$-periodic function and if $\epsilon>0$ is fixed, then there exists a trigonometric polynomial $P$ such that
$$\left|P(x)-f(x)\right|<\epsilon$$
for all real $x$.
Proof: If we identify $x$ and $x+2\pi$, we may regard the $2\pi$-periodic functions on $\mathbb{R}^1$ as functions on the unit circle $T$, by means of the mapping $x\rightarrow e^{ix}$. The trigonometric polynomials, i.e., the functions of the form
$$Q(x)=\sum^N_{-N} c_ne^{inx}\qquad(x\mbox{ real})$$
form a self-adjoint algebra $\mathscr{A}$, which separates points on $T$, and which vanishes at no point of $T$. Since $T$ is compact, the Stone-Weierstrass theorem tells us that $\mathscr{A}$ is dense in $\mathscr{C(T)}$. This is exactly what the theorem asserts.

I have already seen the proof of this theorem discussed in the site, however I have never found a satisfactory explanation of the passages omitted by Rudin (more advanced tools are usually used to answer the existing questions but that does not help). I have tried proposing my attempt at a proof, however I immediately realized it was flawed (it implied the map $z \to e^{ix}, x \in [0,2\pi[$ to be continuous).
I think that Rudin is being a little too much elliptic here. In fact, I interpreted his first statement as "we can define a continuous function g on $S^1$ such that:
$$g(z) = f(x), \hspace{5mm} \text{$x$ is the unique element of $[0,2\pi[$ such that $z=e^{ix}$ "}$$ and then the rest of the proof proceeds smoothly. My problem is that there is a non-trivial property of $g$ that must be proved in order to make use of the Stone-Weierstrass Theorem, that is, $g$ is continuous. Rudin doesn't even acknowledge that and I did not manage to prove that it is actually continuous so far. Therefore I am not even sure that this is the right interpretation of what is written.
If someone could give me some guidance that would be very appreciated!
 A: Let $\log_1\colon\Bbb C\setminus[0,\infty)\longrightarrow\Bbb C$ be the antiderivative of $\frac1z$ which maps $-1$ into $\pi i$. It is a continuous function (actually, it is an analytic function). Then, for each $z\in T\setminus\{1\}$,$$g(z)=f\left(\frac{\log_1(z)}i\right)=f\left(-i\log_1(z)\right),$$and therefore $g$ is continuous on $T\setminus\{1\}$.
Now, let $\log_2\colon\Bbb C\setminus(-\infty,0]\longrightarrow\Bbb C$ be the antiderivative of $\frac1z$ which maps $1$ into $0$. Again, it is continuous. And, since $f$ is periodic with period $2\pi$, for each $z\in T\setminus\{-1\}$, you have $g(z)=f\left(-i\log_2(z)\right)$.
This proves that the restrictions of $f$ to $T\setminus\{1\}$ and to $T\setminus\{-1\}$ are continuous. Since these are open subsets of $T$ whose union is $T$, $g$ is continuous.
A: Define
$$\phi : \mathbb R \to S^1, \phi(x) = e^{ix} = \cos x + i \sin x. $$
It is well-known that this map is a continuous surjection such that $\phi(x) =\phi(y)$ iff $x - y = 2k \pi$ for some $k \in \mathbb Z$. It is moreover an open map. See for example Open sets on the unit circle $S^1$. Hence $\phi$ is a quotient map. This implies that it induces a bijection between the set of continuous maps $f : \mathbb R \to X$ with period $2\pi$ and the set of continuous maps $\bar f : S^1 \to X$. Here $X$ is any topological space.
Update:
If you want to avoid the concept of quotient map, you can argue as follows. It is clear that $\phi$ induces a bijection
$$\phi_* : \mathcal P_{2\pi} (\mathbb R,X) \to \mathcal F (S^1,X) $$
where $X$ is any topological space, $\mathcal P_{2\pi} (\mathbb R,X)$ denotes the set of all (not necessarily continuous) functions $f :\mathbb R \to X$ with period $2\pi$ and $\mathcal F (S^1,X)$ denotes the set of all functions $g : S^1 \to X$. In fact, $\phi_*(f)$ is the unique function such that $\phi_*(f) \circ \phi = f$. We have $\phi_*(g \circ \phi) = g$ which shows that $\phi_*$ is surjective. Moreover, if $\phi_*(f_1) = \phi_*(f_2)$, then $f_1 =  \phi_*(f_1) \circ \phi = \phi_*(f_2) \circ \phi = f_2$ which shows that $\phi_*$ is injective.
Let us prove the following useful
Lemma. $\psi : (-\pi/2,\pi/2) \stackrel{\phi}{\to} S^1_r$ is a homeomorphism onto the right open half-circle $S^1_r = \{z \in S^1 \mid \operatorname{Re} z > 0 \}$.
Proof. $\psi$ is well-defined because $\psi(x) = \cos x + i\sin x$. The map $p : S^1_r \to (-1,1), p(z) = \operatorname{Im} z$, is a homeomorphism (its inverse $p^{-1}$ is  given by $p^{-1}(t) = \sqrt{1-t^2} +it$). Thus it suffices to show that $\bar \psi = p \circ \phi : (-\pi/2,\pi/2) \to (-1,1)$ is a homeomorphism. But $\bar \psi(x) =  \sin x$ which finishes the proof since $\sin : (-\pi/2,\pi/2) \to (-1,1)$ is well-known to be a homeomorphism.
Let us now show that $\phi_*(f)$ is continuous iff $f$ is continuous.

*

*If $\phi_*(f)$ is continuous, then trivially $f = \phi_*(f) \circ \phi$ is continuous.


*Let $f$ be continuous. We want to show that $\phi_*(f)$ is continuous. Continuity on $S^1_r$ (in particular in $1 \in S^1$) follows from the Lemma: We have $$\phi_*(f) \mid_{S^1_r} = \phi_*(f)\circ \psi \circ \psi^{-1} = \phi_*(f) \circ \phi \mid_{(-\pi/2,\pi/2)} \circ \psi^{-1} = f \mid_{(-\pi/2,\pi/2)} \circ \psi^{-1} .$$
Now let $z \in S^1$ be arbitrary. We want to show that $\phi_*(f)$ is continuous in $z$. The map $\mu_z : S^1 \to S^1, \mu_z(w) = z \cdot w$, is a homeomorphism (its inverse is $\mu_{z^{-1}}$). Since $\mu_z(1) = z$, it suffices to show that $\phi_*(f) \circ \mu_z^{-1}$ is continuous in $1$. Write $z = e^{i\xi}$. The map $\bar f : \mathbb R \to X, \bar f(x) = f(x-\xi)$, is continuous with period $2\pi$, thus we know that $\phi_*(\bar f)$ is continuous in $1$. We claim that $\phi_*(f) \circ \mu_z^{-1} = \phi_*(\bar f)$ which finishes the proof. By definition of $\phi_*$ we have to show that $\phi_*(f) \circ \mu_z \circ \phi = \phi_*(\bar f) \circ \phi = \bar f$. But
$$\phi_*(f)(\mu_z^{-1}(\phi(x)) = \phi_*(f)(\mu_z^{-1}(e^{ix}) = \phi_*(f)(e^{ix}/z) = \phi_*(f)(e^{i(x-\xi)}) = \phi_*(f)(\phi(x-\xi)) = (\phi_*(f) \circ \phi)(x-\xi) = f(x-\xi)= \bar f(x) .$$
