A subset S of a ring R is called multiplicative if 1 \in S and st \in S for all s, t \in S [1]. The two main examples are the powers 1, f, f^2, \ldots of one element f, and the complement R \setminus \mathfrak{p} of a prime ideal, which is multiplicative exactly because \mathfrak{p} is prime. The ring \mathbb{Z}_{(p)} of the article on local rings uses S = \mathbb{Z} \setminus p\mathbb{Z}.
On pairs (a, s) \in R \times S, set (a, s) \sim (b, t) when u(at - bs) = 0 for some u \in S. The class of (a, s) is written a/s, the set of classes S^{-1}R, and with a/s + b/t = (at + bs)/st and (a/s)(b/t) = ab/st it is a ring [1,2]. The extra factor u keeps the relation transitive when R has zero divisors.
The map a \mapsto a/1 is a ring homomorphism R \to S^{-1}R, but it can lose elements: a/1 = 0 means ua = 0 for some u \in S. In \mathbb{Z}/6 with S = \{1, 3\}, the class of 2 becomes 0 because 3 \cdot 2 = 0, and S^{-1}(\mathbb{Z}/6) \cong \mathbb{Z}/2. If 0 \in S, for example when S consists of the powers of a nilpotent element, every element becomes 0 and S^{-1}R is the zero ring.
For a domain and 0 \notin S, nothing is lost, and u can be dropped: a/s = b/t exactly when at = bs. For R = \mathbb{Z} and S = \{1, 2, 4, 8, \ldots\}, this says that the points (s, a) and (t, b) of the plane lie on the same line through the origin. In the figure, each such line collects the pairs that name one fraction, as in 1/2 = 2/4 = 4/8, and S^{-1}\mathbb{Z} is the ring \mathbb{Z}[1/2] of fractions whose denominator is a power of 2.
In S^{-1}R every s \in S becomes a unit with inverse 1/s, and S^{-1}R is the most general ring in which this happens. If \varphi \colon R \to A is a ring homomorphism that sends every element of S to a unit, there is exactly one homomorphism \tilde{\varphi} \colon S^{-1}R \to A with \tilde{\varphi}(a/1) = \varphi(a), namely \tilde{\varphi}(a/s) = \varphi(a)\varphi(s)^{-1} [1].
The formula is well defined: if u(at - bs) = 0, then \varphi(u)(\varphi(a)\varphi(t) - \varphi(b)\varphi(s)) = 0, and since \varphi(u), \varphi(s), \varphi(t) are units, \varphi(a)\varphi(s)^{-1} = \varphi(b)\varphi(t)^{-1}. It is forced, because \tilde{\varphi}(a/s)\tilde{\varphi}(s/1) = \tilde{\varphi}(a/1). So any two rings with this property are isomorphic, and we may recognize S^{-1}R by its maps instead of by its fractions.
For example, for f \in R the ring R_f = S^{-1}R with S = \{1, f, f^2, \ldots\} is isomorphic to R[t]/(ft - 1). A homomorphism from R[t]/(ft - 1) to A is a homomorphism \varphi from R together with an element \varphi(t) satisfying \varphi(f)\varphi(t) = 1, so it exists exactly when \varphi(f) is a unit, and then \varphi(t) = \varphi(f)^{-1} is determined. So the two rings have the same homomorphisms to every ring A, and they are isomorphic.
In the figure, R = \mathbb{R}[x, y] and f = x, so R_x \cong \mathbb{R}[x, y, t]/(xt - 1) is a ring of functions on the surface xt = 1 in space. Above each point (a, b) of the plane with a \neq 0 lies the single point (a, b, 1/a), and evaluation at (a, b) extends to R_x by sending t to 1/a. As the point approaches the line x = 0, its partner on the surface goes off to infinity, and on that line there is no extension.
An ideal I of R extends to the ideal S^{-1}I of fractions a/s with a \in I, and an ideal J of S^{-1}R contracts to its preimage, the set of a \in R with a/1 \in J [1]. Every ideal of S^{-1}R is the extension of its contraction, since a/s \in J gives a/1 = (s/1)(a/s) \in J. In the other direction something can be added.
In \mathbb{Z}[1/2], the ideal (12) extends to the ideal generated by 12 = 4 \cdot 3, which is generated by 3 because 4 is a unit, and this contracts to 3\mathbb{Z}, larger than 12\mathbb{Z}. In general the contraction of S^{-1}I consists of the a with ua \in I for some u \in S. The prime (2) contains 2 \in S, so its extension contains 2/2 = 1 and is the whole ring.
For prime ideals the round trip is exact. If \mathfrak{p} \cap S is empty and a/1 = c/s with c \in \mathfrak{p}, then u(as - c) = 0 for some u \in S, so usa \in \mathfrak{p} and us \notin \mathfrak{p} give a \in \mathfrak{p}. One checks in the same way that S^{-1}\mathfrak{p} is prime. So the prime ideals of S^{-1}R correspond to the prime ideals of R that do not meet S, with inclusions preserved [1].
In the figure, R = \mathbb{R}[x, y] and S = \mathbb{R}[x] \setminus \{0\}, so S^{-1}R = \mathbb{R}(x)[y], the polynomials in y whose coefficients are rational functions of x. A point (a, b) is the maximal ideal (x - a, y - b), which contains x - a \in S, so every point disappears, and so does every vertical line x = a.
A curve such as y = x^2 - 1 or y^2 = x + 1 survives. For the second, a polynomial in x alone that is divisible by y^2 - x - 1 must be 0, because a nonzero multiple has degree at least 2 in y. The surviving primes are those meeting \mathbb{R}[x] only in 0, such as (0) and (g) for an irreducible polynomial g that involves y.
For a prime ideal \mathfrak{p}, the localization R_{\mathfrak{p}} is S^{-1}R with S = R \setminus \mathfrak{p}. Its prime ideals correspond to the primes contained in \mathfrak{p}, so \mathfrak{p}R_{\mathfrak{p}} is the only maximal ideal and R_{\mathfrak{p}} is local [1,2]. For R = \mathbb{Z} and \mathfrak{p} = (p) this gives \mathbb{Z}_{(p)}, whose only prime ideals are (0) and p\mathbb{Z}_{(p)}.
Since inclusions are preserved, a chain \mathfrak{p}_0 \subsetneq \cdots \subsetneq \mathfrak{p}_n of primes of R_{\mathfrak{p}} is the same as such a chain of primes of R ending inside \mathfrak{p}. So \dim R_{\mathfrak{p}} equals the height of \mathfrak{p}, the largest length of a chain of primes ending at \mathfrak{p}. For \mathbb{R}[x, y] at (x, y) the chain (0) \subsetneq (y) \subsetneq (x, y) already has length 2.
Many properties can be checked at one prime at a time. An element a is 0 when a/1 = 0 in R_{\mathfrak{m}} for every maximal ideal \mathfrak{m} [1]: if a \neq 0, the elements u with ua = 0 form a proper ideal, which lies in some maximal ideal \mathfrak{m}, and then no u outside \mathfrak{m} kills a.
Also (a/s)^n = 0 means ua^n = 0 for some u \in S, so (ua)^n = 0 and a/s = ua/us is a fraction of a nilpotent element. Hence the nilradical of S^{-1}R consists of the fractions of nilpotent elements, and combining the two facts, R is reduced exactly when every R_{\mathfrak{m}} is reduced.
For example, in R = \mathbb{R}[x]/(x^2(x - 1)) the element a = x(x - 1) is not 0, but a^2 = 0. In R_{(x - 1)} the element x is a unit, so x^2(x - 1) = 0 gives x - 1 = 0 and a/1 = 0. In R_{(x)} the element x - 1 is a unit, so x^2 = 0 there, and a/1 = (x - 1)x is a unit times x, which is not 0.
In the figure, the representatives x(x - 1)(1 + hx) of a all have value 0 and slope -1 at 0, while at 1 they have value 0 but slopes 1 + h that change with h. In R_{(x)}, where x^2 = 0, an element is determined by its value and slope at 0, and the slope -1 is not 0. In R_{(x - 1)} only the value at 1 counts, and it is 0. So a is nonzero only in the localization at the point 0.