Cohomology comes as a dual response to homology. Homology identifies the shape of a topological space by finding "holes". More concretely, looks objects without boundary that are not the boundary of anything (and therefore $H_k(X)=\text{ker }\partial_n/\text{im }\partial_{n+1}$, $\partial$ being the boundary operator)

Cohomology works completely different, at least in the beginning. Cohomology doesn't look for subspaces catching holes, instead assigns a value to each "subobject" in the space. Weird, isn't it? Let's come down to examples

Our first example is $\mathbb{R}^2$, in which we assign to each curve (oriented, with initial point and final point) the value of the horizontal projection. If the curve flows to the right, this value increases, and if it flows to the left, this value decreases. This is nice; this way, our assignment is additive and differentiable: if we split up the curve in multiple pieces, then it is the same computing the value of the initial curve or summing up all the contributions of the individual pieces So far so good. In fact, the previous example is dead simple; the curve itself is not very important, knowing the $x$-coordinates of the initial and final points is enough: its difference is the assigned value. This has immediate implications, namely that every closed curve is assigned a value of 0. Let's move to a less obvious example. We still work on $\mathbb{R}^2$, and we have a vector field, $f(x,y)=(y,0)$. We may think in the following assignment: to each curve $\gamma$, its assigned value is the line integral $\int_{\gamma}f$. In the picture we may appreciate that the value of the curve does not depend solely on the initial and final points, because curves that first go upwards and then go downwards have a positive line integral, while curves that first go downwards and then go upwards have a negative line integral. Moreover, in this case, a closed curve does not always have null line integral; in the picture, the small curve has a slightly negative line integral, because in the top it goes against the current, and in the bottom it goes with the current, but in the top the current is stronger A third example: in $\mathbb{R} ^2-{(0,0)}$ we considerate the assignment swept central angle. This example is somewhat similar to the first one. It just matters the initial angle and the final angle. So for a small closed curve, the swept angle is 0. But take care! The second picture has a curve that surrounds the origin and that sweeps an angle of $2\pi$, that's not what we thought for closed curves! But this can only happen when the space contain holes: we have assigned 0 for small closed curves, those that are the boundary of some small disc, but other values are allowed for other closed curves, those that perhaps are not the boundary of anything. It's like rating homological objects: 0 for for curves not surrounding the origin, $2\pi$ for curves surrounding it once, $4\pi$ for those surrounding it twice, and so on As discussed above, we would like our assignment to be additive. This way, it would be enough to value small pieces of curve, or small patches of surfaces, or small surfaces. That's a local valuation... and that's exactly what differential forms do in differentiable manifolds! Differential forms give a local valuation in each point and each direction The language of differential forms will make everything easier when working with cohomology. The assignment is just the integration of forms! The previous examples would use the 1-forms $\alpha_1=\mathrm{d} x$, $\alpha_2=y\mathrm{d} x$ and $\alpha_3=\frac{-y}{x^2+y^2}\mathrm{d} x+\frac{x}{x^2+y^2}\mathrm{d} y$ (the last one is not defined in the origin!) And this phenomenon of closed curves, having different values according to being the boundary of something... it all has to do with the exterior derivative $\mathrm{d}$ and Stokes Theorem. Think about it! In the first and third case, $\mathrm{d}(\alpha_1)=\mathrm{d}(\alpha_3)=0$, and this is why little curves are assigned a value of 0; $\alpha_1$ and $\alpha_3$ are said to be closed. $\mathrm{d}(\alpha_2)=-\mathrm{d} x\wedge \mathrm{d} y\neq 0$, so $\alpha_2$ is not closed. On the other hand, $\alpha_1$ is an exact form: $\alpha_1=\mathrm{d}(x)$, the function $x$ is the one to be evaluated in the initial and final points of the curve, and therefore closed curves, no matter how big, are always evaluated 0, because initial and final points match. $\alpha_3$ is not exact; it would be marvelous that $\alpha_3=\mathrm{d}(angle)$, but there is no such $angle$ function globally defined in $\mathbb{R} ^2-{(0,0)}$, we always have $2\pi$ steps

So in our cohomological search for holes, we have to find closed forms that are not exact. See the resemblance with the homology? We're looking for forms whose exterior derivative is zero that are not the exterior derivative of some other form. Matches exactly! In fact this resemblance is no more than duality, as will see later