Let $X=\text{Spec }A$ be an affine scheme, and $G$ a finite subgroup of automorphisms of $X$. Show that $\text{Spec }A^G$ is $X/G$, with $\pi: X\to X/G$ given by the natural inclusion.
That is, we need to show $\text{Spec }A^G$ satisfies the universal property of the quotient, where $A^G$ is the fixed ring of automorphisms, and the universal property is that (A) $\pi\circ g=\pi$ for all $g\in G$, and (B) If $Y$ is any scheme and $\phi :X\to Y$ a morphism of schemes such that $\phi\circ g=\phi$ for all $g\in G$, then it factors through $\text{Spec }A^G$.
Now, if $Y$ is affine, I think the problem is easy. Since the (antiequivalent) fact is true at the level of rings, then it must be true at the level of affine schemes. That is, if $\psi:B\to A$ satisfies $g\psi(b)=\psi(b)$ for all $g$, then there's a well-defined map $\theta:B \to A^G$ with $\theta(b)=\psi(b)$ that clearly commutes with the inclusion.
However, I'm stuck for when $Y$ is non-affine. The question hints that you should use Prime avoidance, and I think this is used in showing that the fibres consist of the orbits, but I don't know exactly what I am supposed to show.
I added this later, and I'd welcome any corrections, or plainly telling me if I am wrong:
First let us investigate the fibres of the map $\pi$. The inclusion $A^G\hookrightarrow A$ is integral, since every element of $z\in A$ satisfies an equation of the form $\prod_{g\in G}(x-gz)$. Hence, each fiber is non-empty by the Lying Over Theorem. Now if we have two primes in the same fibre, that is $P\cap A^G=Q\cap A^G$, then $P\subseteq \bigcup_{g\in G}gQ$ since if $p\in P$, then $\prod_{g\in G} gu \in P\cap A^G=Q\cap A^G$, so some factor $gu$ must be in $Q$. By prime avoidance, $P\subseteq gQ$ for some $g$, and again by integrality (or even by symmetry) we can conclude $P=gQ$.
Suppose $\phi:\text{Spec } A\to Y$ is a morphism of schemes satisfying $G$-invariance as above. I think the most logical way is to define a map $\bar{\phi}:\text{Spec }A^G\to Y$ set theoretically as $\bar\phi(P)=\phi(P)$. Then to show it is continuous, it would be enough to prove that $\pi$ is a closed map, since $\bar\phi^{-1}(C)$ for some closed set $C\subseteq Y$ is precisely ${\pi(\phi^{-1}(C))}$.
For this, it would be enough to show that, if $\phi^{-1}(C)=V(a)$ for some ideal $a\subseteq A$, then $V(a\cap A^G)\subseteq\pi(V(a))$, (since we have the equality $V(a\cap A^G)=\overline{\pi(V(a))}$ ). But this is true by the Lying Over theorem argument. Therefore $\bar\phi$ is continuous.
Finally, notice that for $f\in A^G$, we have that the localization $(A^G)_f=(A_f)^G$, therefore $\mathcal O_{\text{Spec }A^G}=\pi_*(\mathcal O_{\text{Spec }A})^G$. Hence the map $\mathcal O_Y\to \phi_*(\mathcal O_{\text{Spec }A})^G=\bar\phi_*\pi_*(\mathcal O_{\text{Spec }A})^G=\bar\phi_*\mathcal O_{\text{Spec }A^G}$ already exists and canonically gives a morphism of sheaves $\mathcal O_Y\to \bar\phi_*\mathcal O_{\text{Spec }A^G}$ that finishes our morphism of schemes.
I am no expert, but I think I remember that this holds:
Let $X$ be a scheme with an action of a finite subgroup of automorphisms $G$ and let $\pi \colon X \rightarrow Y$ be a surjective morphism of schemes such that the following three conditions hold:
(i) The fibers of $\pi$ are the orbits of the $G$-action on $X$
(ii) $Y$ has the quotient topology
(iii) There is a natural isomorphism $\mathcal{O}_Y \cong \pi_{*}(\mathcal{O}_X)^G$
Then $\pi$ yields a quotient of $X$ by $G$.