$k$-points and other questions regarding algebraic schemes I am new to the notion of algebraic scheme, so I am not sure if the questions I am about to make are actually trivialities.
The thing is that in James Milne's notes in Algebraic Groups, there is a point in which he says that given a field $k$ and an algebraic $k$-scheme $X$, we can identify $X(k)=\mathrm{Hom}(\mathrm{Spm}(k),X)$ with the set of points $x\in X$ such that the residue field at $x$ is $k$. My question is: why?
I know that given a point $x\in X$, there exists an affine neighbourhood $U=\mathrm{Spm}(A)$ that contains $x$ and $\mathrm{Hom}(\mathrm{Spm}(k),\mathrm{Spm}(A))$ is isomorphic to the set of homomorphisms between $k$-algebras, $\mathrm{Hom}(A,k)$, but I do not know how to continue with the proof.
On the other hand, I have noticed that in almost any other books the authors prefer to use the spectrum of a ring rather than the maximal spectrum of a $k$-algebra, which is the basis for James Milne's book. Why is it? Is it because in the end using Hilbert's Nullstellensatz the prime ideals of $A$ correspond to irreducible sets of $\mathrm{spm}(A)$?
Also, let $(G,m)$ denote an algebraic group over a field $k$. Could someone give me examples that show that when $k$ is not algebraically closed, $(G(k),m(k))$ is not (in general) a group?
 A: Your first question is very similar to an exercise in Hartshorne, (exercise II.2.7).  Except Hartshorne defines schemes differently, using the entire spectrum instead of the maximal spectrum.
I forgot exactly how Milne defines morphisms of $k$-schemes, but if this isn't 100% right you should be able to modify it without difficulty.
Let $f \in X(k) = \textrm{Hom}_{\textrm{$k$-sch}}(\textrm{Spm }k,X)$.  As a morphism of $k$-schemes, $f$ consists of two things: first, an underlying continuous map of topological spaces.  Since $\textrm{Spm } k$ consists of a point, giving such a map is the same as just picking a point $x$ in $X$. Second, a collection of $k$-algebra homomorphisms $f^{\#}(U): \mathcal O_X(U) \rightarrow k$, as $U$ runs through the open neighborhoods of $x$, which are compatible in sense that if $U \supseteq V$ are open neighborhoods of $x$,  and $s \in \mathcal O_X(U)$, then $f^{\#}(U)$ applied to $s$ is equal to $f^{\#}(V)$ applied to $s|_V$.
These homomorphisms induce a homomorphism from their direct limit, that is the stalk $\mathcal O_{X,x}$.    Now we have a $k$-algebra homomorphism $\mathcal O_{X,x} \rightarrow k$, whose kernel must be a maximal ideal, hence the maximal ideal, since $\mathcal O_{X,x}$ is a local ring.  This gives a $k$-algebra homomorphism $\kappa(x) \rightarrow k$, where $\kappa(x)$ is the residue field at $x$.  But since $\kappa(x)$ is a field, the only way this map can be a $k$-algebra homomorphism is if it is an isomorphism, that is, $\kappa(x) = k$.
Conversely, if $x \in X$ has residue field $k$, then the isomorphism $\kappa(x) \rightarrow k$ induces compatible $k$-algebra homomorphisms $\mathcal O_X(U) \rightarrow \mathcal O_{X,x} \rightarrow \kappa(x) \xrightarrow{\cong} k$, which give you a morphism of $k$-schemes $\textrm{Spm } k \rightarrow X$.  You can check that these procedures are inverse to each other.
A: Let $A$ be a finitely generated algebra over a field $k$. It follows from the  nullstellensatz that the maximal ideals $m$ in $A$ are the kernels of $k$-algebra homomorphisms $f$ from $A$ to the algebraic closure of $k$. The maximal ideal $m$ has residue field $k$ if and only if the image of $f$ is $k$. In this way, we get a one-to-one correspondence between the maximal ideals of $A$ with residue field $k$ and the homomorphisms from $A$ to $k$.
