A theorem due to Gelfand and Kolmogorov
Solution 1:
I found a proof in these lecture notes by Garrido and Jaramillo. See Theorem 18. They also have historical references.
Solution 2:
Dugundji's Topology has a very short, readable proof.
you can find the proof on page 289. its very readable.
Solution 3:
The key to the proof is the following fact.
Lemma: Let $X$ be a compact space and let $\varphi:C(X)\to\mathbb{R}$ be a ring-homomorphism. Then there exists $x\in X$ such that $\varphi(f)=f(x)$ for all $f\in C(X)$.
Proof: Note that if $f\in C(X)$ is such that $f\geq 0$ everywhere, then $\varphi(f)=\varphi(\sqrt{f})^2\geq 0$. I claim furthermore that $\varphi$ is an $\mathbb{R}$-algebra homomorphism, so $\varphi(r)=r$ for any $r\in\mathbb{R}$ (thinking of it in $C(X)$ as a constant function on $X$). Indeed, we know this must be true if $r\in\mathbb{Q}$; for arbitrary $r\in\mathbb{R}$, now use the fact that $\varphi(r-q)\geq0$ if $q\leq r$ and $q\in\mathbb{Q}$ and $\varphi(q-r)\geq 0$ if $q\geq r$ and $q\in\mathbb{Q}$.
Now suppose that $\varphi$ is not given by evaluation at any point. Then for each $x\in X$, there is a function $f_x\in C(X)$ such that $\varphi(f_x)\neq f_x(x)$. Letting $r=\varphi(f_x)$ and replacing $f_x$ with $f_x-r$, we may assume $f_x(x)\neq 0$ and $\varphi(f_x)=0$. Replacing $f_x$ with its square, we may further assume that $f_x\geq 0$ everywhere. By compactness of $X$, finitely many of the sets $\{y:f_x(y)>0\}$ cover $X$, and so adding together the corresponding $f_x$'s, we get a function $f\in C(X)$ such that $f>0$ everywhere and $\varphi(f)=0$. But then $1/f$ is continuous so $f$ is a unit and so $\varphi(f)$ cannot be $0$, so this is a contradiction.
Given this fact, the result you ask for follows easily. If $X$ is compact Hausdorff, then we can recover the set $X$ from $C(X)$ (up to canonical bijection) as the set of ring-homomorphisms $C(X)\to\mathbb{R}$. We can moreover recover the topology on $X$ since it is the coarsest topology that makes each element of $C(X)$ continuous, by Urysohn's lemma. (Here if we are identifying $X$ with homomorphisms $C(X)\to\mathbb{R}$, we can think of an element of $C(X)$ as a function on $X$ by evaluation.) So we can recover the space $X$ up to homeomorphism from the ring $C(X)$.
(In fact, it similarly follows from the Lemma that if $X$ and $Y$ are compact Hausdorff, then ring-homomorphisms $C(X)\to C(Y)$ are naturally in bijection with continuous maps $Y\to X$, and this preserves composition. So this gives a contravariant equivalence of categories between compact Hausdorff spaces and rings of the form $C(X)$.)