Understanding how a ring $R$ can be viewed as a ring of functions on $\operatorname{Spec} R$ using polynomial rings as an example I've read that a ring $R$ is often viewed as a ring of functions on its spectrum $\operatorname{Spec} R$ in the following way: $f\in R$ is the function in question, $x\in \operatorname{Spec}R$ an element it's supposed to map. Then $f(x)$ is the element of $R/x$ such that the quotient map $R\to R/x$ maps $f\mapsto f(x)$.
I would like to understand this using an example where it's "obvious" how the elements of our ring should act as functions: Polynomial rings. But I found some obstructions which I'd like to see clarified.
First off, I think it's very natural to consider polynomials in $R[X]$ as functions on $R$ by way of the evaluation homomorphism. So I will always come back to this idea.
So let's look at a few examples:

*

*The complex numbers:

$\mathbb C[X]$ "should" contain functions acting on $\mathbb C$. So $\operatorname{Spec}\mathbb C[X]$ should contain $\mathbb C$. And in a way it does: The prime ideals of $\mathbb C[X]$ are $(0),\mathbb C[X]$ and $(X-z)$, where $z\in\mathbb C$. And the ideals $(X-z)$ correspond to the elements of $\mathbb C$. Also, $\mathbb C/(X-z)\cong\mathbb C$ via the homomorphism evaluating at $z$, and in this way, $f\in\mathbb C[X]$ is actually sent to $f(z)$ by the quotient map $\mathbb C[X]\to\mathbb C[X]/(X-z)$, so it all checks out!
However, what do the remaining elements of the spectrum, $(0)$ and $\mathbb C[X]$, do here? What do they correspond to, and how can I think of a polynomial as acting on them naturally?


*The reals:

Polynomials in $\mathbb R[X]$ should naively be functions on $\mathbb R$. However, the spectrum now contains more elements to act on. The prime ideals are now the trivial ideals, $(X-r), r\in\mathbb R$, and $((X-z)(X-\bar z)),z\in\mathbb C\backslash\mathbb R$.
The polynomials can still be thought of as being maps on $\mathbb R$, where $\mathbb R$ can be included in the spectrum by identifying $r$ with the ideal $(X-r)$. And the additional elements can be thought of as complex numbers to act on, since $\mathbb R[X]/((X-z)(X-\bar z))\cong\mathbb R[z]=\mathbb C$ via the homomorphism evaluating at $z$, and the abstract construction from the beginning actually maps $z$ to $f(z)$.
However, there is no way to distinguish between $z$ and $\bar z$ here. So the spectrum doesn't contain all the complex elements on which a polynomial could act, only up to complex conjugation. Why not include the whole ring? Also, the "superfluous" elements are still there.
 A: It looks like you're in the process of discovering schemes! :D

*

*For the case of the complex numbers, your remarks are really the motivating ideas to passing from the classical algebraic geometry pictures elucidated by the Zariski topology, to those described by the spectrum of a ring: the maximal ideals in $\text{Spec}(\mathbb{C}[X])$ (which are usually called the closed points) are the geometric places of the imagery, consisting of exactly the same points one was used to when studying "varieties as closed subsets of either $\mathbb{A}^n$ or $\mathbb{P}^n$". The newly added point, $\eta = (0)$ (often given the title of the generic point of the affine line) peculiarly lies inside every prime ideal in $\mathbb{C}[X]$, which geometrically corresponds to the fact that $\eta$ "specialises to" - i.e. its closure contains - every other point. Because residue field of $\eta$ is the function field $\mathbb{C}(X)$, evaluating a polynomial at $\eta$ should be thought of as observing the "generic" behaviour of this function, since $\eta$ lies above all other points in $\text{Spec}(\mathbb{C}[X])$; the correct way to make this notion precise is to think of the set of functions on the Zariski open subset $\mathbb{C}\setminus \{a_1,\dots,a_n\}$ as the rational polynomials of the form $\{\frac{f(X)}{(X-a_1)^{d_1}\dots (X-a_n)^{d_n}}\mid f(x) \in\mathbb{C}[X]\} = \mathbb{C}[X][(X-a_1)^{-1}, \dots, (X-a_n)^{-1}]$ and note that the union of all of these is precisely $\mathbb{C}(X)$ (in other words, any of these functions is defined at the point $\eta$). Lastly, the unit ideal $(1)$ is not prime by definition, since the zero ring isn't an integral domain as its 'fraction field' isn't a field.


*These notions, as opposed to the ones from classical algebraic geometry, generalise beautifully when the base field isn't algebraically closed, since they introduce a new incredibly interesting character to the picture: the (absolute) Galois group. When trying to study the affine line $\text{Spec}(k[X])$ for instance, where $k$ is an arbitrary field, we have a - somewhat - explicit description of its points: any non-zero prime ideal $\mathfrak{p} = (p(X)) \in \text{Spec}(k[X])$ is principal, and when extended to the algebraic closure $(p(X))^e \subset \text{Spec}(\overline{k}[X])$ we get a factorisation $(p(X))^e = ((X-a_1)\dots(X-a_n))$ where $a_1,\dots,a_n \in \overline{k}[X]$ are the roots of $p(X)$, which form an orbit of the Galois group $\text{Gal}(\overline{k}/k) = G_k$'s action on $k$, by $p(X)$'s irreducibility. Conversely, any orbit $\{\sigma(a)\}_{\sigma \in \text{Gal}(\overline{k}/k)}\subseteq \overline{k}$ (which is necessarily finite) defines an irreducible polynomial $p(X) := \prod_{b \in \{\sigma(a)\}_{\sigma \in G_k}}(X-b)$ whose coefficients lie in $k$, and thus defines a prime ideal in $\text{Spec}(k[X])$. We've thus realised the description $$
\text{Spec}(k[X]) \cong \text{Spec}(\overline{k}[X])/\text{Gal}(\overline{k}/k)
$$ where $\text{Gal}(\overline{k}/k)$ naturally acts on the set of prime ideals in $\overline{k}[X]$ via preimages. This is a very special instance of Galois descent, which is an important technique in algebraic geometry which simply doesn't have an analogue in the classical algebraic geometry picture. These observations also help answer your question I think: the functions on $k[X]$ are simply Galois-invariant functions defined on the "geometric" space $\text{Spec}(\overline{k}[X])$, and evaluating a function at a point in $\text{Spec}(k[X])$ simply means taking the value of this function at any of the points in the orbit it corresponds to (with the caveat that the answer might not be a number in $k$ :D) - my use of the word "geometric" is to reference the fact that all closed points in $\text{Spec}(\overline{k}[X])$ are of the form $(X-a)$ for $a \in \overline{k}$, just as in the case of the complex numbers above.
I hope this helps and I absolutely love your question!
A: *

*For a prime ideal ${\frak p}\in \operatorname{Spec}(R)$, elements  $f\in R/{\frak p}$ can be taught as functions on $V({\frak p})\subset \operatorname{Spec}(R)$. Especially for maximal ideals $\frak{m}$ s.t. $(X-z)\subset \mathbb{C}[X]$, because of $V({\frak m})=\{{\frak m}\}$ the elements of $R/{\frak m}$ can be taught as functions on one point ${\frak m}$. But for example in your case $(0)\in \operatorname{Spec}(R)$, because of $V((0))=\operatorname{Spec}(R)$, the elemtnts of $\mathbb{C}[X]/(0)=\mathbb{C}[X] $ can be thaught on whole space $\operatorname{Spec}(R)$.

2.The main reason the case of $\mathbb{R}$ is difficult is $\mathbb{R}$ is not  algebraically closed. So there are maximal ideals of $\mathbb{R}[X]$ which is not correspond to elements of $\mathbb{R}$. So we should think $\mathbb{R}[X]$ is function on $\operatorname{Spec}(\mathbb{R}[X])$ not on $\mathbb{R}$.
