For any CW complex $X$ one defines a chain complex $C_*(X)$: choose an orientation of each cell; the group $C_n(X)$ is the free abelian group with a basis whose elements correspond to the $n$-cells of $X$ and the differential $C_n(X)\to C_{n-1}(X)$ is defined by $c\mapsto \sum_{c'\subset\partial c} (c,c')c'$ where $(c,c')$ is the incidence number of $c$ and $c'\subset\partial c$ defined as follows.

By the definition of a CW complex one can extend the homeo of an open $n$-ball to $c$ to a map of the closed ball; compose the restriction of this map to the boundary $S^{n-1}$ of the closed ball with the map $X_{n-1}\to S^{n-1}$ obtained by collapsing all cells of the $n-1$ skeleton of $X$ but $c'$ to a point; the incidence number of $c$ and $c'$ is the degree of the resulting map $S^{n-1}\to S^{n-1}$ where the first sphere is oriented using the "outgoing normal first" rule and the orientation of the second one is induced from $c'$.

This generalizes the chain complex of a simplicial set. The homlogy of $C_*(X)$ is isomorphic to the singular homology of $X$, see e.g. Hatcher, Algebraic topology, p. 137 (freely available online) or Milnor, Stasheff, Characteristic classes, Appendix A.