Ok the nurse is back with my medication, so here is an example, probably familiar to all, of the connection between integration and cohomology. Now completely technically, a cocycle is an animal that lives over the space and spits out a number when it sees a loop, i.e. a homology cycle. Moreover it spits out the same number if the loops are homotopic, i.e. deformable into each other. Further, if a new loop is made by following one loop by another, then the number for the big loop is the sum of the numbers for each of the two conjoined loops.
Thus the spitting out numbers process defines a "homomorphism (addition preserving map) from the group of homotopy classes of loops to the group of numbers. Since this last group is abelian we actually have a homomorphism from the abelianization of the group of homotopy classes of loops. That is called the first homology group. So a cocycle is a function on homology cycles.
Now where do such things come from? Well the only guy I know that always spits out a number when it sees a loop is a path integral, i.e. a differential one form. So a differential one form is a cocycle, and hence should define a cohomology element. But we need the form to be "closed" so that it will have the same integral over homotopic loops, and hence also over homologous loops. I.e. a form is called closed, as usual , if it is locally df for some function f. Then two loops are homologous if and only if every closed form has the same integral over both of them.
But also a closed form is not just locally, but globally of form df, if and only if it has integral zero over all loops. The upshot is we can define cohomology without mentioning path integrals as follows:
Consider the vector space of all closed differential one forms, and mod out by the subspace of all "exact" one forms, i.e. those globally of form df. This is called the first deRham cohomology group and measures the global topology of the space. E.g. on the once punctured plane, this is a one dimensional space generated by the angle form "dtheta" (not globally df because theta = f is not globally defined).
This little gadget detects how many times a loop winds around the origin and can be used to quickly prove the fundamental theorem of algebra for example.
Now let's do some "sheaf cohomology": In complex analysis, we all know that path integration is done by residue calculus, which has nothing to do with paths, and only to do with "principal parts" of Laurent series. So all this makes sense purely algebraically. So consider the space of all "principal parts on a compact Riemann surface (i.e. a compact real 2 manifold with a complex structure, like the zero locus of a general polynomial in two variables, extended into the projective plane).
Then quotient out by the subspace of principal parts coming from global rational functions, or global meromorphic functions (they are the same). This quotient space measures the principal parts that do not come from global meromorphic functions, i.e. the failure of the Mittag Leffler theorem on the given Riemann surface. This quotient group is called the first cohomology group with coefficients in the "sheaf" of holomorphic, or regular algebraic, functions on the Riemann surface, or algebraic curve.
It has a definition via "derived functors" if you like, well really the same definition, but just a fancier name for it. I.e. the "obvious" map from the sheaf of meromorphic functions to the sheaf of principal parts, has kernel the sheaf O of holomorphic functions, and both previous sheaves are "flabby" so this is a flabby resolution of the sheaf "O" of holomorphic functions, so computes both H^0(O) and H^1(O).
yatta Yatta,..., then one gets the Riemann Roch theorem, which is just a measurement of the failure of Mittag Leffler. I.e. we know the "residue theorem" says that a meromorphic differential always has sum of its residues equal to zero, and vice versa, any collection of principal parts with sum of residues equal to zero is the principal parts of a global meromorphic function. Then Riemann Roch says that given any set of local principal parts, they come from a global meromorphic function if and only if when multiplied by every regular differential form, the sum of the residues is zero.
This can also be fancied up as a statement aboiut sheaves or line bundles or whatever, to the effect that the analytic euler characteristic of a line bundle equals a universal polynomial in the chern classes of the line bundle and the Riemann surface. A mouthful way of saying it equals the (signed) number of points in the principal part, plus 1- the topological genus of the surface.
I.e. h^0(L) - h^0(K-L) = deg(L) + 1-g, where K is the sheaf of differential forms, and g is the genus, and h^0 is the dimension of the space of global holomorphic (or regular) sections of the given bundle. To prove this, the previous defition of H^1 can be generalized to define H^1(L) for any L, and then one proves that h^0(L) - h^1(L) = deg(L) + 1-g, and finally one proves that h^0(K-L) = h^1(L), thus eliminating the highewr cohomology from the theorem. Of course Riemann did it by integration theory and proving the converse of the residue theorem. But we do it by "cohomology", i.e. quotient groups, and algebra.