Short answer: you don't want to consider group cohomology as defined for finite groups for Lie groups like $U(1)$, or indeed topological groups in general. There are other cohomology theories (not Stasheff's) that are the 'right' cohomology groups, in that there are the right isomorphisms in low dimensions with various other things.
Long answer:
Group cohology, as one comes across it in e.g. Ken Brown's book (or see these notes), is all about discrete groups. The definition of group cocycles in $H^n(G,A)$, for $A$ and abelian group, can be seen to be the same as maps of simplicial sets $N\mathbf{B}G \to \mathbf{K}(A,n)$, where $\mathbf{B}G$ is the groupoid with one object and arrow set $G$, $N$ denotes its nerve and $\mathbf{K}(A,n)$ is the simplicial set corresponding (under the Dold-Kan correspondence) to the chain complex $\ldots \to 1 \to A \to 1 \to \ldots$, where $A$ is in position $n$, and all other groups are trivial. Coboundaries between cocycles are just homotopies between maps of simplicial spaces.
The relation between $N\mathbf{B}G$ and $K(G,1)$ is that the latter is the geometric realisation of the former, and the geometric realisation of $\mathbf{K}(A,n)$ is an Eilenberg-MacLane space $K(A,n)$, which represents ordinary cohomology ($H^n(X,A) \simeq [X,K(A,n)]$, where $[-,-]$ denotes homotopy classes of maps). This boils down to the fact that simplicial sets and topological spaces encode the same homotopical information. It helps that $N\mathbf{B}G$ is a Kan complex, and so the naive homotopy classes are the right homotopy classes, and so we have
$$sSet(N\mathbf{B}G,\mathbf{K}(A,n))/homotopy \simeq Top(BG,K(A,n))/homotopy = [BG,K(A,n)]$$
In fact this isomorphism is a homotopy equivalence of the full hom-spaces, not just up to homotopy.
If we write down the same definition of cocycles with a topological group $G$, then this gives the 'wrong' cohomology. In particular, we should have the interpretation of $H^2(G,A)$ as isomorphic to the set of (equivalence classes of) extensions of $G$ by $A$, as for discrete groups. However, we only get semi-direct products of topological groups this way, whereas there are extensions of topological groups which are not semi-direct products - they are non-trivial principal bundles as well as being group extensions. Consider for example $\mathbb{Z}/2 \to SU(2) \to SO(3)$.
The reason for this is that when dealing with maps between simplicial spaces, as $N\mathbf{B}G$ and $\mathbf{K}(A,n)$ become when dealing with topological groups, it is not enough to just consider maps of simplicial spaces; one must localise the category of simplicial spaces, that is add formal inverses of certain maps. This is because ordinary maps of simplicial spaces are not enough to calculate the space of maps as before. We still have $BG$ as the geometric realisation of the nerve of $\mathbf{B}G$, and so one definition of the cohomology of the topological group $G$ with values in the discrete group $A$ is to consider the ordinary cohomology $H^n(BG,A) = [BG,K(A,n)]$.
However, if $A$ is also a non-discrete topological group, this is not really enough, because to define cohomology of a space with values in a non-discrete group, you should be looking at sheaf cohomology, where the values are taken in the sheaf of groups associated to $A$. For discrete groups $A$ this gives the same result as cohomology defined in the 'usual way' (say by using Eilenberg-MacLane spaces).
So the story is a little more complicated than you supposed. The 'proper ' way to define cohomology for topological groups, with values in an abelian topological group (at least with some mild niceness assumptions on our groups) was given by Segal in
G Segal, Cohomology of topological groups, in: "Symposia Mathematica, Vol. IV (INDAM, Rome, 1968/69)", Academic Press (1970) 377–387
and later rediscovered by Brylinski (it is difficult to find a copy of Segal's article) in the context of Lie groups in this article.
The answer is already given in the comments (by Ryan Budney and Mizar). But I think it makes sense to clear this confusing point. The classical Gauss-Bonnet formula is [e.g. https://en.wikipedia.org/wiki/Gauss%E2%80%93Bonnet_theorem ]
$$\int_M K dA+\int_{\partial M} k_g ds=2\pi \chi(M).$$
In this formula nothing requires orientation of $M$! $dA$ is the area element, $ds$ is the line element on the boundary, $K$ is the Gauss curvature and $k_g$ is the geodesic curvature of the boundary. Note that while the sign of the geodesic curvature generally depends on a choice of a normal to the curve, in this particular situation this choice is predetermined (it is the inner normal). There is a way to prove this equality without introducing any orientation, but even if you only have a proof for the oriented case the doubling arguments (mentioned in the comments) trivially extends it to non-orientable surfaces.
The orientability mess comes from not too faithful to the original generalizations of this formula to higher dimensions. If I am not mistaken, the first generalization [The Gauss-Bonnet Theorem for Riemannian Polyhedra Carl B. Allendoerfer and Andre Weil, Transactions of the American Mathematical Society Vol. 53, No. 1 (Jan., 1943), pp. 101-129] does not really presuppose orientability, but it is difficult to spot this as it is almost perfectly obscured by the notation. But the subsequent development follows the lines of Chern [A Simple Intrinsic Proof of the Gauss-Bonnet Formula for Closed Riemannian Manifolds
Shiing-Shen Chern Annals of Mathematics Second Series, Vol. 45, No. 4 (Oct., 1944), pp. 747-752]; in this approach what is integrated is a differential form (rather then a density) which, of course, requires orientation.
In the Chern method, what is actually computed is not the Euler characteristic of the manifold but the Euler class of its tangent bundle. Which is the same thing except the Euler class only makes sense for orientable vector bundles, hence the restriction. This restriction is convenient but not necessary for the Gauss-Bonnet formula (regardless of dimension).
Best Answer
The normal bundle to $M$ in $M\times M$ is isomorphic to the tangent bundle of $M$, so a tubular neighborhood $N$ of $M$ in $M\times M$ is isomorphic to the tangent bundle of $M$. A section $s$ of the tangent bundle with isolated zeros thus gives a submanifold $M'$ of $N \subset M\times M$ with the following properties:
1) $M'$ is isotopic to $M$.
2) The intersections of $M'$ with $M$ are in bijection with the zeros of $s$ (and their signs are given by the indices of the zeros).
The desired result then follows from the Hopf index formula.