I am trying to understand whether there is a sense in which cohomology always relates to topology or whether this is the case only in particular examples. According to the Wikipedia page, a cochain complex is defined as:

“… a sequence of abelian groups or modules ..., $A_0$, $A_1$, $A_2$, $A_3$, $A_4$, ... connected by homomorphisms $d^n$ : $A^n$ → $A^{n+1}$ satisfying $d^{n+1} \cdot d^n$ = 0. “

Based on this one defines the nth cohomology group $H^n$ as the group

$H^n := ker \, d^n / \, im \, d^{n-1}$ .

As a physicist, I am most familiar with examples of cochains and cohomology appearing in the context of *topology*. For instance, de Rham cohomology in which $d$ is identified with the exterior derivative and $A^n$ with the space of differential forms of degree $n$ on a smooth manifold $M$. In this case cohomology groups capture topological invariants of the manifold $M$.

Although the general definition above makes no explicit reference to a topological space, I often see the claim that cohomology is a branch of topology. In fact, from the mathoverflow page cohomology is defined as:

"A branch of algebraic topology concerning the study of cocycles and coboundaries."

Thus, my question is the following:

Q: Is there a sense in which, given a *general* cochain complex, its cohomology captures topological invariants of *some* underlying topological space?

Q': If so, what defines the underlying topological space?

Q'': If not, is there still a sense in which cohomology groups are some sort of “invariants?”