Spectrum of a ring
From Academic Kids

In abstract algebra and algebraic geometry, the spectrum of a commutative ring R, denoted by Spec(R), is defined to be the set of all prime ideals of R. It is commonly augmented with the Zariski topology and with a structure sheaf, turning it into a locally ringed space.
Contents 
Zariski topology
Spec(R) can be turned into a topological space as follows: a subset V of Spec(R) is closed if and only if there exists a subset I of R such that V consists of all those prime ideals in R that contain I. This is called the Zariski topology on Spec(R).
Spec(R) is a compact space, but almost never Hausdorff: in fact, the maximal ideals in R are precisely the closed points in this topology. Spec(R) is always a T_{0} space, however. It is a spectral space.
Sheaves and schemes
To define a structure sheaf on Spec(R), we first define D_{f} to be the set of all prime ideals P in Spec(R) such that f is not in P. {D_{f}}_{f∈R} is a basis for the topology of open sets. We define a sheaf on the D_{f} by setting Γ(D_{f}, O_{X})=R_{f}, the localization of R at the multiplicative system {1,f,f^{2},f^{3},...}. It can be shown that this satisfies the necessary axioms to be a BSheaf. Next, if U is the union of {B_{i}}_{i∈I}, we let Γ(U,O_{X})=lim_{i∈I} R_{fi}, and this produces a sheaf; see the sheaf article for more detail.
To obtain a direct description of Γ(U, O_{X}) for any open set U in X, we notice that the limit above has the universal property that if T is any commutative ring and R_{fi}→T is any system of maps which agree when restricted to R, then there is a unique map Γ(U,O_{X})→T through which the given maps factor. Since each f_{i} maps to a unit in T, if we let S be the multiplicative set generated by {f_{i}}_{i∈I}, then by the universal property of localization we get a unique map S^{1</sub>R→T through which each Rfi→T factors. This is the same universal property that Γ(U,OX) has, so Γ(U,OX)=S1</sub>R. }
To obtain an even more direct description of Γ(U, O_{X}), let S' be the complement in R of all the prime ideals in U. S' is a multiplicative set, since it is the intersection of the multiplicative sets R\P, where P is a prime ideal in U. Each f_{i} is in S' , so S⊆S' . For the other inclusion, choose a g in S' , and suppose that g is not in S. Then g is not a unit in S^{1</sub>R, so we may find a prime ideal P of R which contains g and does not meet S. P must lie in U, but then by the definition of S' , g is not in S' . Consequently, Γ(U, OX)=S' 1</sub>R. }
While this direct description may appear useful, most operations on sheaves can more easily be carried out on Bsheaves, and since a Bsheaf can always be extended to a sheaf in the setting of schemes, it is usually more useful to work over basic open sets.
If P is a point in Spec(R), that is, a prime ideal, then the stalk at P equals the localization of R at P, and this is a local ring. Consequently, Spec(R) is a locally ringed space.
Every sheaf of rings of this form is called an affine scheme. General schemes are obtained by "gluing together" several affine schemes.
Functoriality
It is useful to use the language of category theory and observe that Spec is a functor. Every ring homomorphism f : R → S induces a continuous map Spec(f) : Spec(S) → Spec(R) (since the preimage of any prime ideal in S is a prime ideal in R). In this way, Spec can be seen as a contravariant functor from the category of commutative rings to the category of topological spaces. Moreover for every prime P the homomorphism f descends to homomorphisms
 O_{f 1(P)} → O_{P},
of local rings. Thus Spec even defines a contravariant functor from the category of commutative rings to the category of locally ringed spaces. In fact it is the universal such functor and this can be used to define the functor Spec up to natural isomorphism.
The functor Spec yields a contravariant equivalence between the category of commutative rings and the category of affine schemes; each of these categories is often thought of as the opposite category of the other.
Motivation from algebraic geometry
Following on from the example, in algebraic geometry one studies algebraic sets, i.e. subsets of K^{n} (where K is an algebraically closed field) which are defined as the common zeros of a set of polynomials in n variables. If A is such an algebraic set, one considers the commutative ring R of all polynomial functions A → K. The maximal ideals of R correspond to the points of A (because K is algebraically closed), and the prime ideals of R correspond to the subvarieties of A (an algebraic set is called irreducible or a variety if it cannot be written as the union of two proper algebraic subsets).
The spectrum of R therefore consists of the points of A together with elements for all subvarieties of A. The points of A are closed in the spectrum, while the elements corresponding to subvarieties have a closure consisting of all their points and subvarieties. If one only considers the points of A, i.e. the maximal ideals in R, then the Zariski topology defined above coincides with the Zariski topology defined on algebraic sets (which has precisely the algebraic subsets as closed sets).
One can thus view the topological space Spec(R) as an "enrichment" of the topological space A (with Zariski topology): for every subvariety of A, one additional nonclosed point has been introduced, and this point "keeps track" of the corresponding subvariety. One thinks of this point as the "generic point" for the subvariety. Furthermore, the sheaf on Spec(R) and the sheaf of polynomial functions on A are essentially identical. By studying spectra of polynomial rings instead of algebraic sets with Zariski topology, one can generalize the concepts of algebraic geometry to nonalgebraically closed fields and beyond, eventually arriving at the language of schemes.
External link
 Kevin R. Coombes: The Spectrum of a Ring (http://odin.mdacc.tmc.edu/~krc/agathos/spec.html)fr:Spectre d'anneau