Understanding schemes, even just $\Bbb A^1_{\Bbb C}$? Let $S= \text{Spec}(\Bbb C[X])$.
We know that the closed points of $S$ are $\{(x-a):a\in \Bbb C\}$ and there is one generic point $\{(0)\}$. So we understand $S$ set-theoretically. Next we must understand the scheme sheaf-theoretically. So we have that:
$$O(u)=\{s| s:U\to \cup_{p\in U} A_p\},$$
where $A_p$ is the localization at $p$, such that $s(p)\in A_p$ and this is a local quotient.
I think my understanding would be improved by explicitly seeing that $O(D(f))=A_f$.
I have read that we can consider the elements $f\in \Bbb C[X]$ as functions on $S$ by defining for $p\in S$, $f(p)$ to be the image of $f$ under the composition:
$$\Bbb{C}[X] \to \Bbb{C}[X]/(p) \to \kappa(p).$$

I am generally unhappy about this, since say I take $a/f\in A_f$ as an apparent section of $O(D(f))$, so that:
$$a/f: D(f) \to \cup_{p\in D(f)} A_p,$$
then $(a/f)(p)$ is meant to be the image of $a/f$ under this composite map, but $a/f$ isn't even necessarily an element of the first space (i.e. of $\Bbb{C}[X]$)?
 A: Let $A$ be a commutative ring with unity. We are trying to set up the structure sheaf $\mathcal{O}$ on $\text{Spec}(A)$.
One way to do this is to define $\mathcal{O}$ as a "sheaf on a distinguished base" and extend the sheaf uniquely to all open sets via a well-known theorem in sheaf theory. On $\text{Spec}(A)$, our distinguished base is the collection of distinguished open sets $D(f)$: thus, this way we begin with the explicit assumption that $\mathcal{O}(D(f)) = A_f$ and build the whole sheaf out of this assumption.
Note that $D(f) \subset \text{Spec}(A)$ (with the subspace topology induced by the Zariski topology on $\text{Spec}(A)$) is in fact homeomorphic to $\text{Spec}(A_f)$ (with the Zariski topology on $\text{Spec}(A_f)$), via the map of spectra induced by the map $A \to A_f$. 
This motivates setting $\mathcal{O}(D(f)) = A_f$. It also allows us to interpret elements of $\mathcal{O}(D(f))$ as functions on $\text{Spec}(A_f)$: an element $x \in \mathcal{O}(D(f)) \cong A_f$ maps the point $\mathfrak{p} \in D(f) \approx \text{Spec}(A_f)$ to $x(\mathfrak{p}) \in A_f / \mathfrak{p} A_f$.
Here's the details, at the end of which we'll return to the example $A = \mathbb{C}[x]$:
Part 1: Sheaves on Bases
Definition: Let $X$ be a topological space and $\mathcal{B} = \{B_i\}$ a base of open sets for the topology on $X$. There is a category associated with $X$ whose objects are open sets and whose morphisms are inclusions; let $\text{Cat}(\mathcal{B})$ denote the full subcategory whose objects are the base elements in $\mathcal{B}$.
A sheaf on the base $\{B_i\}$ is a functor $\mathcal{F} : \text{Cat}(\mathcal{B}) \to \text{Sets}$ (or abelian groups, or rings, or whatever) satisfying identity and gluing axioms:


*

*If $B = \bigcup_{i} B_i$ and $f, g \in \mathcal{F}(B)$ restrict to equal sections on each $B_i$, then $f = g$.

*If $B = \bigcup_{i} B_i$, and $f_i \in \mathcal{F} (B_i)$ such that the restrictions of $f_i$ and $f_j$ to $B_i \cap B_j$ are equal, then there is some $f \in \mathcal{F}(B)$ restricting to $f_i$ on every $B_i$.


Theorem: If $X$ is a space, $\mathcal{B}$ is a base, and you've got a sheaf on $\mathcal{B}$ in the above sense, it extends uniquely to a sheaf on $X$.
Proof: See Theorem 2.7.1 in Vakil's algebraic geometry notes. $\blacksquare$
Part 2: Setting up a Sheaf on Distinguished Open Sets
So the distinguished open sets $D(f)$ form a base for the Zariski topology on $\text{Spec}(A)$. Recall that explicitly, we have $$D(f) = \{\mathfrak{p} \subset A \, : \, f\not\in \mathfrak{p}\} = \phi(\text{Spec}(A_f))$$ where $\phi: \text{Spec}(A_f) \to \text{Spec}(A)$ is the map induced by $A \to A_f$.
We will need a few facts about the distinguished open sets; proving these facts amounts to simply unraveling the algebra behind the definitions.
Fact 1: For a commutative ring $A$, if $\text{Spec}(A) = \bigcup_{i \in \mathcal{I}} D(f_i)$ for some index set $\mathcal{I}$, then there exists a finite set $\mathcal{J} \subset \mathcal{I}$ such that $\text{Spec}(A) = \bigcup_{j \in \mathcal{J}} D(f_j)$. Furthermore, the $\{f_j\}_{j \in \mathcal{J}}$ generate $A$.
Fact 2: If $D(f) \subset D(g)$, then $f\in \sqrt{(g)}$ (recall: $\sqrt{I}$ denotes the radical of the ideal $I$).
Fact 3: For any $f, g$, we have $D(f) \cap D(g) = D(fg)$.
Let $\mathcal{B} = \{D(f)\}_{f \in A}$ and define a functor $\mathcal{F} : \text{Cat}(\mathcal{B}) \to \text{Comm-Rings}$ as follows: 


*

*Set $\mathcal{F}(D(f)) := A_f$. 

*For an inclusion $D(f) \subset D(g)$, set the restriction map to be the localization map $A_g \to (A_g)_f$. There is a canonical isomorphism $(A_g)_f \cong A_f$ given by $g^{-1} \mapsto hf^{-k}$ for some $h\in A$, $k \in \mathbb{N}$ such that $gh = f^k$ (such $h$, $k$ exist by Fact 2 above; canonical since the choice of $h$, $k$ evidently doesn't matter). 


Now, by Part 1, we have to show the following theorem:
Theorem: The base presheaf $\mathcal{F}$ is actually a base sheaf.
Proof (adapted from Vakil's notes): We must show the base identity and base gluing axioms hold. Note that if we can show these axioms for the case where $B = \text{Spec}(A)$, then we are done.
(Why? Because $D(f)$ is homeomorphic to $\text{Spec}(A_f)$, and this homeomorphism takes a distinguished open subset $D(g \in A) \subset D(f)$ into precisely the distinguished open subset $D(g \in A_f) \subset \text{Spec}(A_f)$.)
Base Identity:
Suppose $\text{Spec}(A) = \bigcup_{i \in \mathcal{I}} D(f_i)$. From Fact 1, we can replace $\mathcal{I}$ with a finite subset $\mathcal{J} = \{1, \cdots, n\}$ and write $\text{Spec}(A) = \bigcup_{j = 1}^{n} D(f_j)$.
Suppose we are given $s \in A$ such that $s \vert_{D(f_i)} = 0$ for all $i \in \mathcal{I}$. In commutative algebra, this means that for each $1\le j \le n$, there is some $m_j$ such that ${f_j}^{m_j} s = 0$ in $A$. Taking $m = \max\{m_1, \cdots, m_n\}$, we actually have ${f_j}^m s = 0$ for all $1\le j \le n$.
Now, from Fact 1 we actually know $\{f_j\}_{1\le j \le n}$ generate $A$; hence $\{{f_j}^m \}_{1\le j \le n}$ generate $A$ (prove this!). Thus, there are $r_j \in A$ such that $$\sum_{j=1}^{n} r_j {f_j}^m = 1.$$ Multiplying both sides by $s$ gives $s = 0$.
Base Gluing:
Again, suppose $\text{Spec}(A) = \bigcup_{i \in \mathcal{I}} D(f_i)$. Suppose we are given elements $s_i \in \mathcal{O}(D(f_i)) = A_{f_i}$ such that $$s_i \vert_{D(f_i) \cap D(f_j)} = s_j \vert_{D(f_i) \cap D(f_j)}.$$ 
What does this equation mean in commutative algebra? By Fact 3, we have $D(f_i) \cap D(f_j) = D(f_i f_j)$. Writing $s_i = a_i / {f_i}^{\ell_i}$, we see the equation translates to the existence of some $m_{ij}$ such that $$(f_i f_j)^{m_{ij}} ({f_j}^{\ell_j} a_i - {f_i}^{\ell_i} a_j) = 0$$ in $A$.
Now, let's assume $\mathcal{I}$ is finite. We can then take $m = \max\{m_{ij}\}$ and write $${f_i}^m {f_j}^{m+\ell_j} a_i = {f_i}^{m+\ell_i} {f_j}^{m} a_j$$ in $A$ for all $i, j$.
Again using Fact 1, we have that $\{{f_i}^{m+\ell_i}\}$ generates $A$, so there are $r_i \in A$ such that $1 = \sum r_i {f_i}^{m+\ell_i}$. Set $$r:= \sum r_i {f_i}^m a_i$$ and note that $$r {f_j}^{m+\ell_j} = \sum_{i} r_i {f_i}^m {f_j}^{m+\ell_j} a_i = \sum_{i} r_i {f_i}^{m+ \ell_i} {f_j}^m a_j = {f_j}^m a_j.$$ Thus, $r \in A$ restricts to $s_i$ on $D(f_i)$ for all $i \in \mathcal{I}$.
If, on the other hand, $\mathcal{I}$ is infinite: by Fact 1, there is some finite subset $\mathcal{J}$ such that the $D(f_j)$ for $j \in \mathcal{J}$ cover $\text{Spec}(A)$. By the above argument, we can choose some $r \in A$ such that $r\vert_{D(f_j)} = s_j$ for all $j \in \mathcal{J}$. We claim this $r$ actually restricts as desired even for indices in $\mathcal{I} \setminus \mathcal{J}$.
Taking arbitrary $k \in \mathcal{I} \setminus \mathcal{J}$, we also obtain some $r' \in A$ such that $r' \vert_{D(f_j)} = s_j$ for all $j \in \mathcal{J} \cup \{k\}$. But by the base identity axiom, $r = r'$, so it follows $r\vert_{D(f_k)} = s_k$, as desired. $\blacksquare$
We can even make sense of all the symbol pushing above. As Vakil mentions in his notes, Serre once described this argument as "partitions of unity." Note the analogy to partitions of unity arguments from manifold theory (if you know any).
Part 3: Example of $A = \mathbb{C}[x]$
Let's consider $D(x) \subset \text{Spec}(\mathbb{C}[x])$. We have $\mathcal{O}(D(x)) = \mathbb{C}[x]_{(x)} \cong \mathbb{C}[x, 1/x]$.
Consider the element $1/x \in \mathcal{O}(D(x))$. We can think of this as a "function" on $D(f) \cong \text{Spec}(\mathbb{C}[x]_{(x)})$ whose value at $\mathfrak{p} \subset \mathbb{C}[x]_{(x)}$ is in the residue field $\mathbb{C}[x]_{(x)}/\mathfrak{p}\mathbb{C}[x]_{(x)}$.
The primes in $\mathbb{C}[x]_{(x)}$ are precisely the principal ideals $(x-a)$ for $a \neq 0$, and the residue class of $1/x$ in $\mathbb{C}[x]_{(x)}/ (x-a) \mathbb{C}[x]_{(x)}$ is $1/a$.
