What is the inverse image of a sheaf
Well, the definition is quite natural: To give a presheaf, you tell what its section are. So let $U$ be an open subset of $X$. Then
$$ f_{pre}^{-1}\mathcal G (U) := \lim_{V \supseteq f(U)} \mathcal G(V)$$
where $V$ ranges over the open subsets of $Y$ containing $f(U)$. The reason we have to get fancy and use limits, is that $f$ is not necessarily an open mapping. So what does this mean? Sections of $f_{pre}^{-1}\mathcal G(U)$ are equivalence classes $[s,V]$, where $[t,W] \sim [s,V]$ is there is some $U^\prime$ contained in both $V,W$ and containing $f(U)$ such that the restrictions of $s,t$ are equal in $U^\prime$. However, this is not a sheaf (if anyone has an example, where the sheaf properties fails, I'd be happy to see it), so we have to sheafify. But the essence is clear.
This is very technical, so lets see this for a few examples.
- If $f$ is the inclusion of a point $x$ in $Y$, $f:\{pt\} \to Y$, then $f^{-1}\mathcal G$ is just the stalk $\mathcal G_x$.
- If $f$ is an open mapping (for example if $f$ is flat), then $f^{-1}\mathcal G (U)$ is just $\mathcal G (f(U))$.
Also: When dealing with coherent sheaves, one defines $f^\ast \mathcal F := f^{-1}\mathcal F \otimes _{f^{-1}\mathcal O_Y } \mathcal O_X$. In the affine case, this just corresponds to tensor products of the corresponding modules. I.e. if a $A \to B$ is induced by $\mathrm{Spec} B \to \mathrm{Spec} A$, and $\mathcal F= M^\sim$ is the sheaf associated to the $A$-module $M$, then $f^\ast \mathcal F$is just the sheaf associated to the $B$-module $M \otimes_A B$.
A note about sheafyfing: Sometimes a presheaf is not a sheaf, so one must sheafify. The sheafification is "just" the best approximation of $\mathcal F$ such that the stalks are the same. Thus $f^{-1}_{pre}\mathcal G$ and its sheafification $f^{-1}\mathcal G$ agrees for sufficiently small open sets.
@Fredrik
you ask for an example of a presheaf $\mathscr F = f_{pre}^{-1} (\mathscr G )$ which is not a sheaf: Take a topological space $Y$, choose $X$ as two disjoint copies of $Y$ and set
$$f: X \longrightarrow Y$$
the canonical projection. Take $\mathscr G$ a sheaf on $Y$. For $V \subset Y$ open and $U := f^{-1}(V)$ we have $\mathscr F(U) = \mathscr G(V)$. On the other hand,
$$(f^{-1} \mathscr G) (U) := \mathscr F^{sh}(U)=\mathscr G(V) \times{} \mathscr G(V)$$
with the associated sheaf $\mathscr F^{sh}$.
Note. Due to comments changed coproduct to product.