TITLE: Explicit surjection $\mathbb{A}^n\longrightarrow \mathbb{P}^n$
QUESTION [9 upvotes]: Let $k$ be an algebraically closed field. I have been told several times that for any $n\geq 0$, there exists a morphism of $k$-schemes $\mathbb{A}^n_k\rightarrow \mathbb{P}^n_k$ that is surjective on the underlying topological spaces. I was not able to find an explicit example of a such a morphism. 
Now, the talk about "a sufficiently general collection of polynomials" nerves me out. If I give you $\mathrm{char}\,k$ and $n$, can you give me an explicit example of a surjection $\mathbb{A}^n_k\rightarrow \mathbb{P}^n_k$? 
I believe I can do this for $n=0$. Pretty much by definition we have identifications $\mathbb{A}^0_k\approx \mathrm{Spec}\,k$ and $\mathbb{P}^0_k\approx \mathrm{Spec}\,k$, so we can take the identity morphism $\mathrm{Spec}\,k\rightarrow \mathrm{Spec}\,k$. 
EDIT: to state the obvious, in our case it is enough to verify surjectivity on closed points. The set-theoretic image of a morphism of finite presentation is constructible. A constructible set containing all closed points of a scheme of finite type over an algebraically closed field should be the whole space (since otherwise its complement would be a non-empty constructible set containing no closed points; a constructible set contains an open dense subset of its closure and in a scheme of finite type over an algebraically closed field, closed points are dense in any closed subset).

REPLY [20 votes]: Let me give a solution for $n=2$, that can be easily generalized to all $n$.
Let us consider the morphism $$f \colon \mathbb{P}^2 \to \mathbb{P}^2, \quad f([x:y:z]) =[x^2:y^2:z^2].$$
This is a Galois cover, with Galois group isomorphic to the Klein group $\mathbb{Z}_2 \times \mathbb{Z}_2$ and ramified on the union of the three lines $x=0$, $y=0$, $z=0$, with ramification index generically $2$. There are precisely three points with total ramification, namely $[1:0:0]$, $[0:1:0]$, $[0:0:1]$.
If we take a general line $H$ disjoint from the total ramification locus, then the restriction of $f$ to $\mathbb{P}^2 - H$ remains surjective onto $\mathbb{P}^2$. But  $\mathbb{P}^2 - H$ is clearly isomorphic to $\mathbb{A}^2$, so we are done.