Definition of morphism of affine space I am a little bit confused about some basic terminology: What exactly do we mean by a morphism of the affine space $\mathbb{A}_k^n \rightarrow \mathbb{A}_k^n$, where e.g. $k$ is algebraically closed field?
How is this definition adapted if we assume that we have a structural sheaf
on $\mathbb{A}_k^n$?
 A: If you're thinking of $\mathbf{A}_k^n$ as the affine scheme $\mathrm{Spec}(k[X_1,\ldots,X_n])$, then a morphism $\mathbf{A}_k^n\rightarrow\mathbf{A}_k^n$ means a morphism of $k$-schemes. The $\mathrm{Spec}$ functor is fully faithful, so any morphism from $\mathbf{A}_k^n$ to itself is $\mathrm{Spec}(\varphi)$ for a unique $k$-algebra map $\varphi:k[X_1,\ldots,X_n]\rightarrow k[X_1,\ldots,X_n]$. The universal property of the polynomial algebra over $k$ says that such a morphism is equivalent to the data of an  $n$-tuple of elements in the target, i.e., $n$ polynomials $f_1,\ldots,f_n$. So specifying a morphism is the same as giving an $n$-tuple of polynomials in $k[X_1,\ldots,X_n]$. This extends to $k$-morphisms $X\rightarrow\mathbf{A}_k^n$ for any $k$-scheme $X$: such a morphism is uniquely determined by the data of an $n$-tuple of global sections of $\mathscr{O}_X$, i.e., an element of $\mathscr{O}_X(X)^n$. In fact it works for $R$-morphisms $X\rightarrow\mathbf{A}_R^n$ for any $R$-scheme $X$ and any ring $R$...or even any base scheme $S$. 
A: Another answer has described morphisms of $\mathbb{A}^n$ within the category of affine schemes. Here's a discussion of maps in the category of affine spaces, since both are useful in many contexts.
$\mathbb{A}^n$ is a $k^n$-torsor, which means there's a regular group action of $k^n$ on $\mathbb{A}^n$, namely the one sending $x\in\mathbb{A}^n\mapsto x+v,v\in k^n$. This is usually intuitively described as $\mathbb{A}^n$ being $k^n$ without an origin. (Indeed there's a forgetful functor $U$ taking a vector space to its underlying affine space, as well as a functor $D$ taking $\mathbb{A}^n$ to $k^n$. These aren't quite adjoints, because $UD$ isn't naturally isomorphic to the identity functor on the affine category.)
So the only operation we get inside $\mathbb{A}^n$ is subtraction: $x-y$ is the unique $v\in k^n$ such that $x+v=y$. Then the endomorphisms of $\mathbb{A}^n$ are its endomorphisms as a $k^n$-torsor, which might be described as $f:\mathbb{A}^n\to\mathbb{A^n}$ such that $f(x)-f(y)=A(x-y)$ for $A$ a linear transformation $k^n\to k^n$, a map that preserves subtraction "up to a linear transformation." 
If you were to (non-naturally) associate $\mathbb{A}^n$ with $k^n$, you would see that the affine linear maps $f: v\mapsto Av+u$ satisfy the above definition, while conversely you could get $u$ as the image of whatever affine point was sent to $0$ and $A$ as the $f-u$, but it's cleaner to avoid using the functor $D$.
