Varying definitions of cohomology

So I know that given a chain complex we can define the $d$-th cohomology by taking $\ker{d}/\mathrm{im}_{d+1}$. But I don't know how this corresponds to the idea of holes in topological spaces (maybe this is homology, I'm a tad confused).

-
One can compute (co)homology of different complexes. In particular, for any topological space one can define it's singular complex (see Eric's answer for an idea how it's done) which in some sense indeed counts holes. But the idea of (co)homology is more general. – Grigory M Jul 24 '10 at 15:28
I couldn't really do better than Eric's answer, and like Grigory says, cohomology is more general. So instead I want to mention a case where cohomology doesn't do this: Sheaf Cohomology of Algebraic Groups, classify dominant Vector Bundles. This is called the Borel-Weil-Bott Theorem and has some nice ramifications for Representation Theory and Algebraic Geometry. – BBischof Jul 24 '10 at 19:48

Simplicial and singular (co)homology were invented to detect holes in spaces. To get an intuitive idea of how this works, consider subspaces of the plane. Here the 2-chains are formal sums of things homeomorphic to the closed disk, and 1-chains are formal sums of things homeomorphic to a line segment. The operator d takes the boundary of a chain. For example, the boundary of the closed disk is a circle. If we take d of the circle we get $0$ since a circle has no boundary. And in general it happens that $d^2 = 0$, that is boundaries always have no boundaries themselves. Now suppose we remove the origin from the plane and take a circle around the origin. This circle is in the kernel of d since it has no boundary. However, it does not bound any 2-chain in the space (since the origin is removed) and so it is not in the image of the boundary operator on two-dimensions. Thus the circle represents a non-trivial element in the quotient space $ker( d ) / im (d)$.
The way I have defined things makes the above a homology theory simply because the d operator decreases dimension. Cohomology is the same thing only the operator increases dimension (for example the exterior derivative on differential forms). Thus algebraically there really is no difference between cohomology and homology since we can just change the grading from $i$ to $-i$.
From a homology we can get a corresponding cohomology theory by dualizing, that is by looking at maps from the group of chains to the underlying group (e.g. $\Bbb Z$ or $\Bbb R$). Then d on the cohomology theory becomes the adjoint of the previous boundary operator and thus increases degrees.