Understanding Chinese Remainder Theorem using Schemes I was looking at Ravi Vakil's Algebraic Geometry notes and in 4.4.11, he states that the Chinese Remainder Theorem is a geometric fact that can be understood through schemes. He uses the example of $\mathbb{Z}/(60)$ to illustrate the sketch of the idea. I am trying to understand how to prove the statement in general using his sketch and ran into some trouble. 
First I'll explain his general sketch and what I have understood in the proof so far :

The Chinese Remainder Theorem says that knowing an integer modulo 60 is the same as knowing an integer modulo $2$,$3$, and $5$.
What is Spec $\mathbb{Z}/(60)$? It is those prime ideals containing $(60)$, i.e., $(2)$, $(3)$, and $(5)$. 

This part is fairly simple. In the general version, this translates as follows: 
Let $n = p_1^{k_1}\cdot p_2^{k_2}\cdot \ldots \cdot p_r^{k_r} \in \mathbb{Z}$
Then Spec $\mathbb{Z}/(n) = \{(p_1), (p_2), \ldots,(p_r)\}$ (With the standard affine structure sheaf, which we shall denote as $\mathcal{O}$)

They (here, (2),(3), and (5)) are all closed points, as these are maximal ideals, so the topology is the discrete topology

Likewise, in the general case this also holds, i.e, each $(p_i)$ is closed since it's maximal and so Spec $\mathbb{Z}/(n)$ has a discrete topology.

What are the stalks? You can check that they are $\mathbb{Z}/4$,$ \mathbb{Z}/3$, and $\mathbb{Z}/5$.

Here's where I had to work some things out. This is what I understood to be the case in general. 
Claim: $\mathcal{O}_{(p_i)} = (\mathbb{Z}/(n))_{(p_i)} \simeq \mathbb{Z}/(p_i^{k_i})$ for each $1 \leq i \leq r$
Proof: 
Let $\pi:\mathbb{Z}/(n) \rightarrow \mathbb{Z}/(p_i^{k_i})$ be the canonical map given by $\bar{x} \mapsto \bar{x}$.
Let $i:\mathbb{Z}/(n) \rightarrow (\mathbb{Z}/(n))_{(p_i)}$ be the standard inclusion $\bar{x} \mapsto \frac{\bar{x}}{1}$
Since $\pi(\mathbb{Z}/(n)-(p_i))$ is the set of units in $\mathbb{Z}/(p_i^{k_i})$, by the universla property of localization, we have a morphism $\psi:(\mathbb{Z}/(n))_{p_i} \rightarrow \mathbb{Z}/(p_i^{k_i})$ such that $\psi \circ i = \pi$.
Similarly, since $i(\bar{p_i}^{k_i}) = \frac{\bar{p_i}^{k_i}}{1} = \frac{\bar{n} }{p_1^{k_1}\cdot p_2^{k_2}\cdot \ldots \cdot p_{i-1}^{k_{i-1}} \cdot p_{i+1}^{k_{i+1}}\cdot \ldots \cdot p_r^{k_r}} = 0$, by the universal property of quotients, we have a morphism $\gamma : \frac{\mathbb{Z}/(n)}{(p_i^{k_i})} \simeq \mathbb{Z}/(p_i^{k_i}) \rightarrow (\mathbb{Z}/(n))_{(p_i)}$ such that $\gamma \circ \pi = i$
It isn't too difficult to show that $\gamma$ and $\psi$ are inverses of each other. Hence the claim is proved.
So far so good (I think). 

So what are the global sections on this scheme? (here, on $\mathbb{Z}/(60)$) They are the sections on this open set $(2)$, this other open set $(3)$, and this third open set $(5)$. In other words, we have a natural isomorphism of rings
$\mathbb{Z}/(60) \rightarrow \mathbb{Z}/(4) \times \mathbb{Z}/(3) \times \mathbb{Z}/(5)$

Here's where I'm a little lost in translation. There are three things I don't quite get. 
1) If we're looking at global sections on the scheme Spec $\mathbb{Z}/(60)$, then don't we need to look at $\mathcal{O}($Spec$\mathbb{Z}/(60))$ and not any of $\mathcal{O} ((2))$, $\mathcal{O} ((3))$, and $\mathcal{O} ((5))$? I'm still trying to understand schemes and sheaves so I want to understand rigorously what Vakil means here. 
2) I know that we can look at $(p_i^{k_i})$ as the principal open 
$\mathcal{D} $ := D$((p_1^{k_1}\cdot p_2^{k_2}\cdot \ldots \cdot p_{i-1}^{k_{i-1}} \cdot p_{i+1}^{k_{i+1}}\cdot \ldots \cdot p_r^{k_r}))$
and so $\mathcal{O}(\mathcal{D}) = (\mathbb{Z}/(n))_{(p_1^{k_1}\cdot p_2^{k_2}\cdot \ldots \cdot p_{i-1}^{k_{i-1}} \cdot p_{i+1}^{k_{i+1}}\cdot \ldots \cdot p_r^{k_r})}$
I don't see why this localization should give us $\mathbb{Z}/(p_i^{k_i})$ as (I think) he seems to be suggesting when he is looking at sections of  $\mathcal{O}_{\text{Spec}\mathbb{Z}/(60)}$ at $(2)$, $(3)$, and $(5)$.
3) How does looking at these global sections automatically give us the desired isomorphism? I don't see the connection between looking at (global) sections of the sheaf and immediately deducing the required isomorphism. 
I'm still trying to learn how schemes work and am trying to develop an intuition for them. Because of that, I'm not very fluent with translating Vakil's less-rigorous questions to very rigorous claims (Or at the very least, they don't seem to rigorous to me. Though I'm well aware that that's solely a lack of understanding on my part). I'd appreciate any help and thanks for taking the time to read this!
Edit: Fixed the typo mentioned in the first answer 
 A: You made a typo in your computation of the stalks, to define $\gamma$: then numerator should be $\overline{n}$, not $\overline{n}\overline{p_i}^{k_i}$. About your specific questions :
1) By the sheaf property, a global section is the same as a family of sections on opens of a covering,  as long as they glue nicely on intersections. Here you have three open (in fact clopen) points which are therefore disjoint : so a global section is just a triple of sections that glue nicely on empty intersections; you can see that this last condition is empty : a global section is just a triple of sections, one on each open point. 
Now, if $x$ is an open point, a section on $\{x\}$ is the same as an element of the stalk, which you computed earlier. 
2) Well the point is that each point ($(2), (3), (5)$) is open, because they're all closed (and there's finitely many of them). Therefore they form an open covering, and so we go back to what I explained in 1).
3) The point is again that the three points are open, and thus form an open covering. Since they are disjoint, the sheaf property says exactly that the product of the three restrictions is an isomorphism.
So I think the main point you missed was that as each of $(2),(3),(5)$ is closed, they are also open (this uses the fact that there's finitely many of them) and are pairwise disjoint, so the sheaf property applied to the open covering $\{\{(2)\}, \{(3)\}, \{(5)\}\}$ gives the isomorphism (together with your computation of the stalks)
