We first list two results of similar form:
Theorem 1. If $X$ is a compact Hausdorff space, then the map $$F: X\to\mathrm{MaxSpec}(C(X,\Bbb R)), F(x)=\{f\in C(X,\Bbb R): f(x)=0\}$$ is a homeomorphism.
Theorem 2. If $k$ is an algebrically closed field, then the map $$F: \mathbb A_k^n\to \mathrm{MaxSpec}(k[x_1,...,x_n]), F((a_1,...,a_n))=\left<x_1-a_1,...,x_n-a_n\right>$$ is a homeomorphism.
Neither of the two results implies each other nor the proof of them seem similar. For example Theorem 1 uses Urysohn Lemma in a crucial way but Theorem 2 is just Zariski Lemma. I wonder if they are special cases of a more general theorem.
In general for some topological space $X$ we can associate to it a ring, say $F(X)$ and we can look now at the Maximal spectrum of $F(X)$. I am asking for the properties of the $X$ and $F$ to allow us have some nice relationship between $X$ and the maximal Spectrum of $F(X)$.