Understanding valutation and residue field I recently started studying the theory of schemes from "The geometry of schemes", by Eisenbud and Harris.
At the very beginning of this volume I unfortunately found the first osbtacle: pick a commutative ring with unity $R$, and consider $f \in R$ as a function on Spec$R$. The authors define $f(\mathfrak{p})$ as the image of $f$ via the canonical maps $$R \rightarrow R/\mathfrak{p}\rightarrow k(\mathfrak{p}) $$
with $k(\mathfrak{p})$ the residue field of $R/\mathfrak{p}$.
If I'm not wrong,  $k(\mathfrak{p})=((A/\mathfrak{p})\setminus \{[0]\})^{-1}A/\mathfrak{p}$, which should be equal to $k(\mathfrak{p}) \simeq A_{\mathfrak{p}}/\mathfrak{p}A_{\mathfrak{p}}$ (but I can't figure out how, all this localisations confuse me).
The problem is that I'm getting confused with all this stuff, I mean, I always naively consider the function $15$ at $(7)$, then $15((7))=1$ mod $7$, or working over $k[x]$, $$x^3-1((x^2+1))= -x-1 (\text{ mod } (x^2+1)).$$ 
But I don't see all this machinery behind this computation, I can do the calculation but I feel I don't undertand what $A_{\mathfrak{p}}/\mathfrak{p}A_{\mathfrak{p}}$ is and why I'm working in this exact space. 
Any help which clarifies the theoretic aspect of this calulations would be appreciate, I'm quite confused about this ring. Thanks in advance.
 A: Maybe it helps to put in something more geometric.
Let's say $k = \bar{k}$ is an algebraically closed field and you look at something like $\mathbb A^n := \mathrm{Spec} \ k[X_1,...,X_n]$.
Let's first consider a global section $f = \sum_{\underline i} a_{\underline i} X_1^{i_1}\cdot ... \cdot X_n^{i_n} \in \Gamma(\mathbb A^n, \mathcal O_{\mathbb A^n}) = k[X_1,...,X_n]$.
Take any closed point $\mathfrak{m} \in \mathbb A^n$. By Hilbert's Nullstellensatz we know that there exist $x_1,...,x_n \in k$ such that $\mathfrak{m} = (X_1 -x_1, ...., X_n-x_n)$.
Now observe that the residue field is given by $\kappa(\mathfrak m) = k[X_1,...,X_n]/\mathfrak m \cong k$ where the last isormophism is given by $X_i \mapsto x_i$.
Now we can compute:
$f(\mathfrak m) = \sum_{\underline i} a_{\underline i} X_1^{i_1}\cdot ... \cdot X_n^{i_n} \equiv \sum_{\underline i} a_{\underline i} x_1^{i_1}\cdot ... \cdot x_n^{i_n} \mod \mathfrak m = f(x_1,...,x_n) \in k$.
Hence if we think of $\mathfrak m$ as the point of $\mathbb A^n$ with coordinates $(x_1,...,x_n)$, this definition of evaluation makes perfectly sense.
Also note that it makes sense that for example $\Gamma(D(g),\mathcal O_{\mathbb A^n}) = k[X_1,...,X_n]_g$:
A function on $D(g)$ is of the form $\frac{f}{g^k}$.
When is a closed point $(x_1,...,x_n)$ in $D(g)$?
Well, $\mathrm{Spec} \ k[X_1,...,X_n]_g \cong \{\mathfrak p \in \mathrm{Spec} \ k[X_1,...,X_n] \mid g \not\in \mathfrak p\}$. 
What does it mean of a maximal ideal $\mathfrak m := (X_1-x_1,...,X_n-x_n)$ to contain $g$?
$g \in \mathfrak m \iff g \equiv 0 \mod \mathfrak m \iff g(x_1,...,x_n) = 0$.
Hence: If $(x_1,...,x_n) \in D(g)$, then $g(x_1,...,x_n) \neq 0$ and hence $\frac{f(x_1,...,x_n)}{g(x_1,...,x_n)} \in k$ is well-defined (and you can check that this really is the evaluation you get using your definition above).
Note that we have non-closed points $\mathfrak p$ in $\mathbb A^n$ as well.
For example the generic point $(0)$. The evaluation at these points won't give us actual numbers, but something different instead. For example $f((0)) = f \in k(X_1,...,X_n)$.
Working over non-algebraically closed fields we might end up getting different residue fields, even in the very "geometric" example of $\mathbb A^n_k$.
For example if $n = 1$ and $k = \mathbb Q$ we have the closed point $(X^2 - 2)$ so that $\kappa( (X^2 - 2) ) = \mathbb Q(\sqrt 2)$.
In the case of $\mathrm{Spec} \ \mathbb Z$ the situation is even more weird:
The residue field at the generic point $(0)$ is given by $\mathbb Q$ and the residue field at a prime $(p)$ is given by $\mathbb F_p$.
Hence a function $x \in \Gamma(\mathrm{Spec} \ \mathbb Z, \mathcal O_{\mathbb Z}) = \mathbb Z$ takes values in different fields at every point.
However, it still makes sense to evaluate at every point. And the same intution works for sets like $D(2) = \{(2)\}^{c}.$
As on a point $\mathfrak p \in D(2)$, one has that $2 \in \kappa(\mathfrak p)^\times$, it makes sense to compute $\frac{f}{2^k}(\mathfrak p) = \frac{f(\mathfrak p)}{2(\mathfrak p)} \kappa(\mathfrak p)$.
// Edit:
Also, regarding your question about the residue fields:
Let $A$ be a ring, $S$ a multiplicative subset and $I \subseteq A$ an ideal.
Take the exact sequence $0 \to I \to A \to A/I \to 0$ of $A$-modules.
Applying the exact functor $S^{-1}$ yields the exact sequence:
$0 \to S^{-1}I \to S^{-1}A \to S^{-1}(A/I) \to 0$ of $S^{-1}A$-modules, hence also of $A$-modules via the canonical map $A \to S^{-1}A$.
That is: $S^{-1}A/I \cong S^{-1}A / S^{-1}I$ as $A$-modules.
Both sides are rings, and it is not too difficult to check that the above map sends $1 \mapsto 1$ and that it is multiplicative, hence a ring isomorphism.
This gives you the desired isomorphism that you described in your question.
PS: Ravi Vakil's notes try to be very geometric and are filled with exercises that try to explain, why Algebraic Geometry deserves to be called Geometry.
