The Global Sections Functor and the Hom Functor Why is it possible for us to think of the global sections functor $\Gamma(X,-)$ as the Hom functor $\text{Hom}(\mathbb{Z},-)$ where $\mathbb{Z}$ here refers to the constant sheaf with the integers as the stalk? And why do we need the integers to be the stalk? I believe expressing the global sections functor as the Hom functor means that the sheaf cohomology would  then be expressible in terms of the Ext functor.
Using the Hom functor, I can see somewhat of an analogy with the way cohomology is defined in basic algebraic topology, as the "dual" of singular homology (the cochains are made up of maps from the chains with integer coefficients to the abelian group of the coefficients of the cohomology), so perhaps this is where the integers come from; however I cannot yet see what this has to do with global sections. Please tell me where I can read more about this viewpoint too.
 A: Fist of all, there's a natural isomorphism
$$\Gamma (X,\mathcal{F}) = \mathcal{F} (X) \cong \operatorname{Hom}_\mathcal{Ab} (\mathbb{Z}, \mathcal{F} (X)).$$
(And that's where $\mathbb{Z}$ comes from: it's the free abelian group generated by one element.)
Now I claim that
$$\operatorname{Hom}_\mathcal{Ab} (\mathbb{Z}, \mathcal{F} (X)) \cong \operatorname{Hom}_{\mathcal{PSh} (X)} (\mathbb{Z}_X, i (\mathcal{F})) \cong \operatorname{Hom}_{\mathcal{Sh} (X)} (\mathbb{Z}_X^\mathbf{a}, \mathcal{F}).$$
Here by $\mathbb{Z}_X$ I denote the constant presheaf on $X$ having $\mathbb{Z}$ as its sections, and by $\mathbb{Z}_X^\mathbf{a}$ its sheafification. The second natural isomorphism is basically the definition of sheafification (as the left adjoint to the inclusion $i\colon \mathcal{Sh} (X) \to \mathcal{PSh} (X)$), and we are interested in the first isomorphism.
We need to check that group homomorphisms $f\colon \mathbb{Z} \to \mathcal{F} (X)$ naturally correspond to presheaf morphisms $\mathbb{Z}_X \to \mathcal{F}$. Such a morphism of presheaves is simply a family of homomorphisms $f_U\colon \mathbb{Z} \to \mathcal{F} (U)$ compatible with the restriction maps for $\mathcal{F}$.


*

*In one direction, having such a family $\{ f_U \}$, we just take the homomorphism $f_X\colon \mathbb{Z} \to \mathcal{F} (X)$.

*In the other direction, starting from a group homomorphism $f\colon \mathbb{Z} \to \mathcal{F} (X)$, we may define $\{ f_U\colon \mathbb{Z} \to \mathcal{F} (U) \}$ by taking the compositions of $f$ with the restriction maps $\mathcal{F} (X) \to \mathcal{F} (U)$.
This gives a natural bijection.

Of course, $\mathbb{Z}$ may be replaced with any abelian group: $$\operatorname{Hom}_\mathcal{Ab} (A,\mathcal{F} (X)) \cong \operatorname{Hom}_{\mathcal{PSh} (X)} (A_X, \mathcal{F}) \cong \operatorname{Hom}_{\mathcal{Sh} (X)} (A_X^\mathbf{a}, \mathcal{F}).$$
So we just saw that the global section functor is right adjoint to the constant (pre)sheaf functor.
