Affine Group Scheme Definition From what I understand, a affine group scheme $G$ should be an affine scheme on which there exists a group structure in the sense that 
$$ \phi: G \times_k G \to G $$ 
is also a morphism of groups. 
What does "morphism of groups" means for schemes? 
For a Lie group $G$, it implies that the topological space has the structure of a group, i.e $\phi(xy)=\phi(x)\phi(y)$ for all $x,y \in G$, etc. 
However, for schemes such a definition is confusing since we don't know what "type" of points such a definition would be referring to. 
Is an affine group scheme a scheme whose underlying topological space has the structure of a group? (i.e the morphism $\phi$ is defined on $k$-points of $G$)
Or is it more general, i.e for all schemes $S$, must the $S$-points of $G$ also have the structure of a group? 
 A: Just to clarify, the real subtle point here is the following. For a $k$-scheme $X$ let us denote by $|X|$ the underlying topological space. Then, the behind-the-scenes complication here is that $|X\times_k X|\ne |X|\times |X|$. In fact, there is a continuous surjection $|X\times_k X|\to |X|\times |X|$ which is, in general, not an isomorphism (exercise!).
So, if we have a map $\phi:G\times_k G\to G$ and we have $(g,h)\in |G|$ there is no way to make sense of $\phi(g,h)$--one would have to try and lift them to $|G\times_k G|$ and apply $\phi$ there, but this is not well-defined (exercise!).
To convince yourself of why this is not so weird, consider $G=\mathrm{GL}_2$. Note then that we have that $H=\mathrm{SL}_2$ is a closed subscheme of $G$. Let $\eta$ denote the genric point of $G$ and $\eta'$ the generic point of $H$. Then, we have that $k(\eta)=k(x,y,z,w)$ and $k(\eta')=\mathrm{Frac}(k[x,y,z,w]/(xy-zw-1))$. The maps $ \mathrm{Spec}(k(\eta))\hookrightarrow G$ and $\mathrm{Spec}(k(\eta'))\hookrightarrow G$ correspond to the matrices $\begin{pmatrix}x & y\\ z & w\end{pmatrix}$ interpreted in $k(\eta)$ and $k(\eta')$ respectively. How do you 'multiply' those?
The point though is that while $|G\times_k G|\ne |G|\times |G|$ for every $k$-scheme $S$ we have that $(G\times_k G)(S)=G(S)\times G(S)$. Thus, for every $k$-scheme $S$ the map $\phi:(G\times_k G)(S)\to G(S)$ is a map $G(S)\times G(S)\to G(S)$ which is actually the multiplication for a group structure on $G(S)$.
