Local homeomorphisms: an equivalent approach
In early developments of sheaf theory, it was shown that giving a sheaf F on X is as good as giving a certain topological space E together with a continuous map from E to X. More precisely: to every sheaf F of sets on X there exists a local homeomorphism π E → X such that F is isomorphic (in the sense of natural isomorphism, the isomorphism concept for functors) to the sheaf of sections of π that was described in the example section above.
Furthermore, the space E is determined up to homeomorphism by F. It is the space of stalks of F: each stalk is given the discrete topology, and we take the disjoint union of all the stalks, with π mapping all of the stalk Fx to x. The topology on this space of stalks can be chosen so that the sheaf F can be recovered as the sheaf of sections of π.
At a higher level of abstraction, we can say that the category of sheaves of sets on X is equivalent to the category of local homeomorphisms to X.
The space E was called espace étalé in Godement's influential book about algebraic geometry and sheaf theory (Topologie Algebrique et Theorie des Faisceaux, R. Godement); in that book, sheaves are in fact defined as coming from sections of local homeomorphisms; the functorial approach we gave above came later and is more common nowadays.
The above considerations remain true for sheaves of C on X: we can still form the space of stalks, each stalk is an object in C, and the sections naturally become objects in C as well.
Given an arbitrary continuous map g : Z → X, the corresponding sheaf of sections gives rise in the above manner to a space of stalks E and a local homeomorphism π : E → X. In a sense this deals with all the 'ramification' in the map g, in the 'best possible way'. This may be expressed by adjoint functors; but is also important as an intuition about sheaves of sets. This collection of ideas is related to topos theory, but in a sense that more general notion of sheaf moves away from geometric intuition.
Generalization
One can define cohomology for sheaves of abelian groups on a given topological space. The idea here is that a sheaf serves as a "measuring rod" for the space, and the cohomology groups of the sheaf serve as rough measures of the space when measured with that rod.
By precisely analyzing the properties of X needed to define sheaves, Alexander Grothendieck came up with the concept of a Grothendieck site, defined generalized sheaves on these sites and with that also very general cohomology theories.