Why is the spectrum of a commutative ring only concerned with fields? Let $R$ be a commutative ring.
The (prime) spectrum of $R$ can be constructed as
$$
  \operatorname{Spec}(R)
  =
  \left\{
    (k, φ)
  \;\middle|\;
    \begin{array}{l}
      \text{$k$ is a field,} \\
      \text{$φ \colon R \to k$ is a homomorphism of rings}
    \end{array}
  \middle\}
  \right/
  {\sim}
$$
where $\sim$ is the equivalence relation generated by $(k, φ) \sim (k', ι ∘ φ)$ whenever $ι \colon k \to k'$ is a field extension.
(This construction of the spectrum is equivalent to the usual one via prime ideals by assigning to the equivalence class of $(k, φ)$ the kernel of $φ$.)
In other words, the spectrum of $R$ classifies the different ways in which the ring $R$ maps into fields.
I think this can also be understood as a kind of “geometrification” of the functor
$$
  \operatorname{Hom}(R, -)
  \colon
  \mathbf{Field} \to \mathbf{Set} \,.
$$

I’ve been wondering why the spectrum is constructed in such a way that it is only concerned with fields instead of arbitrary commutative rings.
Indeed, it seems more natural to me to try to “geometrify” the functor
$$
  \operatorname{Hom}(R, -)
  \colon
  \mathbf{CRing} \to \mathbf{Set} \,,
$$
instead since this functor contains all information about the ring $R$ by Yoneda’s lemma.

I suspect that it makes no difference if the ring $R$ is reduced since then any two distinct elements of $R$ can be distinguished by a homomorphism into a suitable field. So I guess that my question has something to do with the role of nilpotents.
 A: There are a few stories one can tell for why the prime spectrum – or rather, the space corresponding to a commutative ring; saying "prime spectrum" presupposes the answer! – is defined the way it is.
One story is that we want to think of fields as being like points.
Recall Euclid's definition: a point is that which has no part.
We might rephrase that in more modern language as follows: a point is an object that is not empty and has no proper subobjects.
And indeed:
Proposition 1. In the opposite of the category of commutative rings, an object has precisely two subobjects if and only if it is a field.
Note that this is a vastly different situation from "real" geometry: "points" can be non-isomorphic, and worse, there might not even be any morphism between two arbitrary "points"!
So, whereas in the category of topological spaces the set of all morphisms $T \to X$ gives a satisfactory set of points of $X$ for any choice of "point" $T$ – because they are all isomorphic! – in the opposite of the category of commutative rings the result  depends on the choice of $T$.
So if we wanted an "absolute" set of points we would have to find some way of accounting for the possibility of varying $T$.
Yet taking the disjoint union of all sets of morphisms $T \to X$ as $T$ varies is unsatisfactory: for one thing, it doesn't account for isomorphs of $T$, and for another there are simply too many isomorphism clases of "points".
In the end the only reasonable thing to do is to quotient by the smallest equivalence relation that identifies two morphisms $T \to X$ and $T' \to X$ if there is a morphism $T' \to T$ completing a commutative triangle.
To put a category-theoretic spin on it, you could call it the set of connected components of the category of "points" of $X$, whose objects are morphisms $T \to X$ where $T$ is a "point" and whose morphisms are commutative triangles.

Another story one could tell is that, in fact, it's all just a coincidence and fields are not actually all that important!
We start from the position that elements of a commutative ring are like  continuous functions on some space and the ring operations behave as if they were defined pointwise.
One thing you can do with ring-valued functions on a space is to take the set of points at which it vanishes, and if the functions are continuous and the value ring is a $T_0$ topological ring, then these sets will be closed subspaces.
For the purposes of this story, let me make a definition:
Definition.
A zero locus map from a commutative ring $A$ to a topological space $X$ is a map $Z$ from $A$ to the set of closed subsets of $X$ with the following properties:

*

*$Z (0) = X$.

*$Z (1) = \emptyset$.

*For all elements $a$ and $b$ of $A$, $Z (a) \cap Z (b) \subseteq Z (a + b)$.

*For all elements $a$ and $b$ of $A$, $Z (a) \cup Z (b) = Z (a b)$.

(I've never seen precisely this concept in the literature, though it is basically inspired by something I've seen attributed to Joyal and, at any rate, can be reverse-engineered from the proposition I state below.)
Example.
If $A$ is any subring of the ring of continuous $\mathbb{C}$-valued functions on $X$ and $Z (a) = \{ x \in X : a (x) = 0 \}$ then $Z$ is a zero locus map.
It is difficult to justify the $Z (a) \cup Z (b) = Z (a b)$ axiom in the presence of zero divisors in the value ring if we take the "zero locus map" terminology too literally.
The next example is what this concept is really about (but I won't explain why).
Example.
Let $A$ be a commutative ring.
Define $Z (a) = \emptyset$ if $a$ has a multiplicative inverse in $A$ and $Z (a) = \{ * \}$ otherwise.
Then $Z$ is a zero locus map from $A$ to $\{ * \}$ if and only if $A$ is a local ring.
Remark.
In fact, if $Z$ is any zero locus map whatsoever, the axioms force $Z (a) = \emptyset$ for all elements $a$ that have a multiplicative inverse.
However, the converse is not true in general.
Proposition 2.
Let $A$ be a commutative ring, let $\operatorname{Spec} A$ be the set of prime ideals of $A$ with the Zariski topology, and let $V (a)$ be the set of prime ideals containing $a$.
Then $V$ is a zero locus map from $A$ to $\operatorname{Spec} A$ and is universal in the sense that, for any zero locus map $Z$ from $A$ to any topological space $X$, there is a unique continuous map $f : X \to \operatorname{Spec} A$ such that $Z (a) = f^{-1} V (a)$.
Thus the prime spectrum of $A$ is the universal space $X$ for which we can consider $A$ to be like a ring of continuous functions on $X$.
(It is not literally true, unless you allow the ring that the functions take values in to vary from point to point.)

Then there is the "real" story, which is sociological/historical.
The space corresponding to a commutative ring is defined to be the prime spectrum because that is what people chose to study all those years ago!
There are other functors from the category of commutative rings to the category of (ringed) topological spaces.
For example, there is the Peirce spectrum of a commutative ring, which is as to indecomposable (a.k.a. connected) rings as the Zariski spectrum is to local rings.
(Furthermore, as with the Zariski spectrum, the ring of global sections of the structure sheaf of the Peirce spectrum of a commutative ring $A$ is naturally isomorphic to $A$.)
To say nothing of some even more obscure constructions discussed in Chapter V of [Johnstone, Stone spaces].

Proof of Proposition 1.
A subobject in the opposite category is a quotient in the original category, so we are supposed to think about epimorphisms in the category of commutative rings.
Let $A$ be a commutative ring.
In general, if $I$ is an ideal of $A$ then we have a regular epimorphism $A \to A / I$, and these are distinct for different $I$.
Thus, there are at least as many quotients of $A$ as there are ideals of $A$.
Hence, if $A$ has exactly two quotients then $A$ has at most two ideals; but if $A$ has exactly one ideal then $A \cong \{ 0 \}$, in which case $A$ has exactly one quotient (because every homomorphism out of $\{ 0 \}$ is an isomorphism), so in fact $A$ must have exactly two ideals.
A commutative ring has exactly two ideals if and only if it is a field, hence if $A$ has exactly two quotients then $A$ is a field.
The above argument also shows that a field has at least two quotients; it remains to be shown that there are no more.
Let $k$ be a field and suppose we have an epimorphism $k \to A$ in the category of commutative rings.
We must show that either $A \cong \{ 0 \}$ or that $k \to A$ is an isomorphism.
Suppose $A \not\cong \{ 0 \}$.
Then $k \to A$ is injective, so we may as well assume it is the inclusion of $k$ as a subring of $A$.
In particular, $A$ is a commutative $k$-algebra and has dimension $\ge 1$ as a $k$-vector space.
Consider $A \otimes_k A$.
There are two embeddings $A \to A \otimes_k A$, namely $a \mapsto a \otimes 1$ and $a \mapsto 1 \otimes a$.
However, they agree on the subring $k$, and since we assumed that $k \to A$ is an epimorphism, that implies $a \otimes 1 = 1 \otimes a$ for all $a \in A$.
But if $1, a$ are $k$-linearly independent in $A$ then $1 \otimes 1, a \otimes 1, 1 \otimes a, a \otimes a$ are $k$-linearly independent in $A \otimes_k A$, so $A$ must be $1$-dimensional as a $k$-vector space.
Hence $k = A$, as claimed. ◼
(I could have saved myself some trouble here by talking about regular subobjects instead of general subobjects, but that felt less convincing.)

Proof of proposition 2.
First, observe that if there is a universal zero locus map as defined in the proposition, then there is a natural bijection between the set of points of the space it maps to and the set of zero locus maps from $A$ to $\{ * \}$.
What is a zero locus map from $A$ to $\{ * \}$?
Well, such a zero locus map $Z$ is uniquely determined by the set $P = \{ a \in A : Z (a) = \{ * \} \}$.
A subset $P \subseteq A$ corresponds to a zero locus map if and only if it satisfies the following conditions:

*

*$0 \in P$.

*$1 \notin P$.

*If $a \in P$ and $b \in P$ then $a + b \in P$.

*If $a b \in P$ then at least one of $a$ or $b$ is also in $P$.

*If $a \in P$ and $b$ is arbitrary then $a b \in P$.

In other words, $P$ corresponds to a zero locus map if and only if $P$ is a prime ideal of $A$.
Thus, if there is a universal zero locus map, the set of points of the space it maps to can be naturally identified with the set of prime ideals.
The above argument is actually irrelevant to the proof – but it "explains" why the prime spectrum appears.
Everything remains to be shown.
I leave it as an exercise to check that given a continuous map $f : X \to \operatorname{Spec} A$, the formula $Z (a) = f^{-1} V (a)$ does in fact define a zero locus map $Z$ from $A$ to $X$.
Furthermore,
$$\{ a \in A : x \in Z (a) \} = \{ a \in A : f (x) \in \{ P \in \operatorname{Spec} A : a \in P \}\} = f (x)$$
so $f$ can be recovered from $Z$.
Conversely, suppose we are given a zero locus map $Z$ from $A$ to $X$.
For $x \in X$, let $f (x) = \{ a \in A : x \in Z (a) \}$.
It is straightforward to check that $f (x)$ is a prime ideal of $A$, so we have a map $f : X \to \operatorname{Spec} A$.
By construction,
$$f^{-1} V (a) =  \{ x \in X : a \in \{ b \in A : x \in Z (b) \} \} = Z (a)$$
as required.
I also leave it as an exercise to check that $f$ is continuous.
We have already seen that $f$ is unique if it exists, so we are done. $\blacksquare$
A: Here are my thoughts on this question.
First, concerning Eric Wofsey's comment:

Well, if you just omit the requirement that $k$ is a field in your definition of Spec, you always get a singleton, since every homomorphism from $R$ to another ring $k$ factors through the identity map $R\rightarrow R$.

Presumably, you mean for $\iota$ to be an embedding? This deals with the objection, and makes the new definition equivalent to considering a "spectrum" consisting of all ideals of $R$.
We can now attempt to set up a theory of schemes on this basis, starting with defining the closed subsets of the ideal spectrum of $R$ to be those of the form $V(A) = \{ I \in \operatorname{Ideals}(R): A \subseteq I \}$, for subsets $A$ of $R$. However, these are not the closed sets of a topology, because we always have $R \in V(A)$, so $\emptyset$ is not closed. We could perhaps get around this by using only the proper ideals.
More seriously, the union of two closed subsets need not be closed. For an example, consider $R = \mathbb{Z}$. Then, $$V(A) = \{ (n) : n\textrm{ divides every member of }A\}.$$ So, $$V(2) \cup V(3) = \{(1),(2),(3)\},$$ which is not closed, because any integer divisible by both $2$ and $3$ is also divisible by $6$.
Maybe there is a way to salvage this, but so far things are looking much less nice than for the prime spectrum.
