TITLE: What is (co)homology, and how does a beginner gain intuition about it?
QUESTION [93 upvotes]: This question comes along with a lot of associated sub-questions, most of which would probably be answered by a sufficiently good introductory text.  So a perfectly acceptable answer to this question would be the name of such a text.  (At this point, however, I would strongly prefer a good intuitive explanation to a rigorous description of the modern theory.  It would also be nice to get some picture of the historical development of the subject.)
Some sub-questions: what does the condition that d^2 = 0 means on an intuitive level?  What's the intuition behind the definition of the boundary operator in simplicial homology?  In what sense does homology count holes?  What does this geometric picture have to do with group extensions?  More generally, how does one recognize when homological ideas would be a useful way to attack a problem or further elucidate an area?

REPLY [57 votes]: I think the most intuitive way to look at topology is as a way to make precise the following idea. A warning: the idea by itself does not define homology, but something much scarier. Homology is what you get when you give up studying the scary but intuitive thing, and try to get something similar, but which you can calculate.
Consider a manifold. Homology is meant to count its submanifolds, up to cobordism. In other words, as out "chains of dimension $n$", take the formal sums of submanifolds of dimension $n$, where the submanifolds might have boundary. The boundary operation $\partial$ just takes the boundary. Notice that the boundary of any manifold is a manifold without boundary, so it's clear that $\partial^2=0$.
Now, the homology of this chain complex counts submanifolds without boundary; two submanifolds are considered different if they are not boundaries of the same higher-dimensional submanifold. If you think of the higher-dimensional submanifolds as a way to "move" one of the submanifolds to another, it makes sense that you might want to think of them as the "same". If a submanifold does not surround a "hole", it is the "same" as the "empty submanifold", this is a sense in which this homology counts holes.

Again, if you try to make this precise, you will run into all kinds of trouble. You'll have to define what a "submanifold" is, whether they can have self-intersections, etc. Then, you'll find that the above kind of "homology" is not really a homotopy invariant, and terribly difficult to calculate.
However, you should compare the above idea to the definition of simplicial homology. You'll see that the cycles you get in simplicial homology are similar to submanifolds, and all the wonderful algebraic machinery will show you that you can actually calculate homology of anything you'd like.
One algebraic topology book that seems to have this approach in it is Bredon's "Topology and Geometry".
The above intuition is especially useful in differential topology. There is a way to make the above idea (called cobordism theory), but you need to know how to use homology to do it. For a taste of it (that doesn't require homology), look in the last chapter of Milnor's "Topology from the Differential Viewpoint".

Three unrelated comments: 

Never expect any intuition from singular (co)homology, and never calculate anything with it; it is merely a tool for showing that other kinds of homology (that you actually care about) are the same and invariant under homotopy.
A completely different (and very precise) way to intuitively think of cohomology is as solutions to a certain differential equation. This is the approach of the "Calculus to Cohomology" book and Bott and Tu's "Differential Forms in Algebraic Topology", and is called De Rham cohomology.
Don't be surprised if there are some mistakes in any of the above; wise people - feel free to point them out and clarify!