Quotient of an affine variety by a finite group coincides with topological quotient as a point set? I have just read the construction of the quotient of a closed subset $X$ of affine space by a finite group $G$ of automorphisms of $X$, in Shafarevich, Basic Algebraic Geometry I. Shafarevich gives this construction:
Replacing the elements of $G$ by their pullbacks, $G$ becomes a group of automorphisms of the coordinate ring $k[X]$.  Then the ring of invariants, $k[X]^G$, is a finitely generated $k$-algebra (we know this from the theory of invariants), and it contains no nilpotents because it is a subring of $k[X]$. Therefore, it is the coordinate ring of some closed $Y\subset\mathbb{A}^n$. Define $X/G=Y$. The quotient map $f:X\rightarrow Y=X/G$ is characterized by having the inclusion $k[Y]=k[X]^G\hookrightarrow k[X]$ as a pullback.
Shafarevich convinced me that $f(x_1)=f(x_2)$ with  $x_1,x_2\in X$ if and only if $\exists g\in G$ such that $gx_1=x_2$. This shows that $\operatorname{im}f$ parametrizes the orbits of $X$ under the $G$-action. The question I still have, though, is why it should be that $\operatorname{im}f$ exhausts $Y$. Since $k[X]^G\hookrightarrow k[X]$ is an injection, it is clear why $\operatorname{im}f$ needs to be dense in $Y$; but in order for this notion of quotient to coincide with my more familiar topological notion, I would like to be sure that it actually exhausts it. So,

How can we be sure that $\operatorname{im}f=Y$?

Here is an equivalent form of the same question, which I am finding it easier to think about. The points of $X,Y$ can be identified with maximal ideals of $k[X],k[Y]$. If I am thinking about this correctly, then for any regular map $g:X\rightarrow Y$, $g(x_0)=y_0$ if and only if $\mathfrak{x_0}$ contains $g^*(\mathfrak{y_0})$, where $\mathfrak{x_0},\mathfrak{y_0}$ are the maximal ideals of $k[X],k[Y]$ corresponding to $x_0\in X,y_0\in Y$. Thus $y_0\in \operatorname{im}g$ if and only if $g^*(\mathfrak{y_0})$ is contained in some maximal ideal of $k[X]$, i.e. it does not generate the unit ideal in $k[X]$. So the above question can be restated:

How can we be sure that $k[X]^G$ does not have any maximal ideals that generate the unit ideal of $k[X]$?

Is it because if a unit of $k[X]$ is $G$-invariant, then its inverse is also $G$-invariant?
Note: I am fairly new to algebraic geometry, so please do not answer in the language of schemes if possible. I am conversant with commutative algebra at the level of Atiyah-Macdonald.
EDIT: As often happens to me on this website, as I wrote out my question I got some new ideas. I now think I can prove what I want if the characteristic of the ground field $k$ does not divide the group order $|G|$. But I hope the surjectivity of $f:X\rightarrow X/G$ doesn't depend on this, so I still very much want to hear your answers. My argument is this:
Let $\mathfrak{a}$ be any ideal of $k[X]^G$. Suppose that $\mathfrak{a}$ generates the unit ideal in $k[X]$. Then there is some equation
$$1=u_1a_1+\dots+u_ma_m$$
where $a_1,\dots,a_m\in \mathfrak{a}\subset k[X]^G$ and $u_1,\dots,u_m\in k[X]$. If $\operatorname{char} k \nmid |G|$, then $|G|$ is a nonzero element of $k$, so we can average the above equation across $G$, to obtain
$$1=u_1'a_1+\dots+u_m'a_m$$
where $u_j'=\frac{1}{|G|}\sum_{g\in G} gu_j$, since $1$ and all the $a_j$'s are fixed under action of $G$. But then $u_1',\dots,u_m'\in k[X]^G$, so that actually $\mathfrak{a}$ must already have been the unit ideal of $k[X]^G$.
How can the reliance on the condition $\operatorname{char}k\nmid |G|$ be removed? Is a totally different argument needed?
 A: The key point is Corollary 5.8 and Theorem 5.10 of Atiyah-Macdonald: let $A \subseteq B$ be an integral extension of rings and let $\mathfrak{m}$ be a maximal idel of $A$, then there exists a maximal ideal $\mathfrak{M}$ of $B$ such that $A \cap \mathfrak{M} = \mathfrak{m}$.
Let $k$ be an algebraically closed field, let $X$ be an affine variety over $k$ and let $G$ be a finite group of $k$-automorphisms of $X$. The inclusion $k[X]^G \hookrightarrow k[X]$ gives a dominant morphism $X \to Y = X/G$. Since $k[X]$ is integral (finite) over $k[X]^G$, then $X \to Y$ is surjective.
A: It is because the extension $k[X]^G\subset k[X]$ is integral: every element of $A=k[X]$ is integral over $A^G$. Indeed, if $f\in A$ and order of $G$ is $n$, then $f$ is a root of the polynomial $X^n-\sigma_1X^{n-1}+\sigma_2X^{n-2}+\dots+(-1)^n\sigma_n$, where $\sigma_1=\sum_{g\in G}gf$, $\sigma_2=\sum_{g,h\in G,g\ne h}gf\cdot hf$, etc. (elementary symmetric functions).
If the extension $A\subset B$ is integral, then the associated morphism $\operatorname{Spec}{(B)}\to \operatorname{Spec}{(A)}$ is closed, which follows immediately from the "going up theorem".
