TITLE: Does the Gauss-Bonnet theorem apply to non-orientable surfaces?
QUESTION [26 upvotes]: I found statements of the Gauss-Bonnet theorem here, here, here, here, here, here, here, and here. None of them require that the surface be orientable. However, Ted Shifrin claims in a comment to this question that the Gauss-Bonnet theorem actually only applies to orientable surfaces. Are these sources all incorrect?

REPLY [8 votes]: Following the OP's request, I'm posting the details of my computations for the explicit embedding of the Möbius strip $M$ in $\Bbb R^3$. The orientation of (halves) of the boundary curve turns out to be the crucial matter, as I'd suspected. Although the theoretical arguments are compelling, I remain confused about what's wrong with the following computations. I can now vouch that the numerics are correct.
Consider the parametrization 
$$x(u,v) = \big((2+v\sin(u/2))\cos u,(2+v\sin(u/2))\sin u,v\cos(u/2)\big), \quad 0\le u\le 2\pi, -1\le v\le 1.$$
Note that $B = x(0,1) = x(2\pi,-1)$ and $C=x(0,-1)=x(0,1)$. 
As you can check, this is an orthogonal parametrization, and the first fundamental form has coefficients $E = \|x_u\|^2 = 4+\frac34 v^2 - \frac12 v^2\cos u + 4v\sin(u/2)$ and $G=\|x_v\|^2 = 1$. 
I'm now going to use the standard formulas for $K$ and $\kappa_g$ in an orthogonal parametrization (see, e.g., my text, pp. 60 and 81):
\begin{align*} K &= -\frac1{2\sqrt{EG}}\left(\Big(\frac{E_v}{\sqrt{EG}}\Big)_v +
\Big(\frac{G_u}{\sqrt{EG}}\Big)_u\right) \\
\kappa_g &=  \frac1{2\sqrt{EG}}\big({-}E_v u'(s) + G_u v'(s)\big)+\theta'(s),
\end{align*}
the latter for an arclength parametrization of the curve. Here $\theta$ is the angle the curve makes with $x_u$ at each point. In our case $\theta'=0$ everywhere. 
Note, also, that (forgetting about orientation issues for the moment)
\begin{align*}
\int_M K\,dA &= \iint_{[0,2\pi]\times [-1,1]} -\frac1{2\sqrt{EG}}\left(\Big(\frac{E_v}{\sqrt{EG}}\Big)_v +
\Big(\frac{G_u}{\sqrt{EG}}\Big)_u\right)\underbrace{\sqrt{EG}\,du\,dv}_{dA} \\ &= -\frac12\int_0^{2\pi}\int_{-1}^1 \Big(\frac{E_v}{\sqrt E}\Big)_v\,dv\,du \\ &= -\frac12\int_0^{2\pi} \Big(\frac{E_v}{\sqrt E}\Big)\Big|_{v=1} - \Big(\frac{E_v}{\sqrt E}\Big)\Big|_{v=-1} \,du. 
\end{align*}
Regarding the orientation issue, surely we'll agree that $|dA|$ should agree with this $dA$ if we remove one ruling of the surface (say the ruling from $B$ to $C$). So this integral should be the density integral.
Now, $E_v/\sqrt E$ is rather a mess, but, using Mathematica to do the numerical integration, we find that this integral is (approximately) $-1.97$. [The most basic check is that it's negative, as we have a non-developable ruled surface.]
We can now use Mathematica to evaluate the geodesic curvature integrals.  We note that $ds = \frac{ds}{du}du$, so $\kappa_g\,ds = \big({-}\frac12 E_v/\sqrt E\big)u'(s)\,ds =\big({-}\frac12 E_v/\sqrt E\big)\,du$. On half the boundary circle, going from $B$ to $C$,
$$-\frac12\int_0^{2\pi} \frac{E_v}{\sqrt E}\Big|_{v=1}du \approx -4.53,$$
and on the other half, going from $C$ to $B$, we have
$$-\frac12\int_0^{2\pi} \frac{E_v}{\sqrt E}\Big|_{v=-1}du \approx -2.56.$$
So $\int_M K\,dA + \int_{\partial M} \kappa_g\,ds \approx -9.06$ (certainly not $0$, nor, indeed, an integer multiple of $2\pi$). 
To double-check this computation, let's remove a tiny bit of our Möbius strip, say the region corresponding to $0\le u\le \varepsilon$. This leaves us an oriented surface, for sure. Its boundary has two extra pieces, $u=0$ (oriented downward) and $u=\varepsilon$ (oriented upward); these have no contribution, regardless of $\varepsilon$, since the $v$-curves are line segments and have no geodesic curvature. The main discrepancy, however, is the reversed orientation on the segment $v=1$. Indeed, for $\varepsilon$ very small, the $v=1$ integral is now approximately $+4.53$, and — mirabile dictu — note that
$$-1.97 + 4.53 - 2.56 = 0,$$
as it should! (The exterior angles of the "rectangle" contribute the $2\pi\chi = 2\pi$.) But I emphasize that when we've removed a bit of the Möbius strip to make an oriented creature, we do not have (almost) the same boundary curve as the Möbius strip. This difference, as far as I'm concerned, is what messes up the Gauss-Bonnet Theorem. One more comment: The definition of $\kappa_g$ (as $\kappa\mathbf N\cdot(\mathbf n\times\mathbf T)$, where $\mathbf T,\mathbf N$ are the Frenet frame of the curve and $\mathbf n$ is the surface normal) makes it clear that when we have an oriented surface with boundary, the sign of $\kappa_g$ does not change if we reverse the orientation of the surface; for when we do, we change both $\mathbf n$ and $\mathbf T$ by a sign. But, if we interpreted $ds$ in this integral as a measure, as @SunghyukPark suggests, it surely must be consistent along the boundary circle of the Möbius strip, so we cannot just switch the sign of half the line integral. ... 
EDIT: OK, I believe I've figured it out, much to my chagrin. We need to think about geodesic curvature intrinsically (as one does in a fancier proof of the Gauss-Bonnet Theorem). If $e_1$ is the unit tangent vector along $\partial M$ and $e_2$ is the inward-pointing normal to $\partial M$ in $M$, then, by definition, $\kappa_g = \nabla_{e_1}e_1\cdot e_2$. So, in fact, on the upper edge $v=1$ of our parametrizing rectangle, the formula for $\kappa_g$ we used earlier is off by a sign, and correcting this is equivalent to reversing the orientation on that upper integral. The correct values are
$$\int_M K|dA| = -1.97 \qquad\text{and}\qquad \int_{\partial M}\kappa_g ds = +4.53-2.56 = +1.97.$$
So the sum is, in fact, $2\pi\chi(M) = 0$, as desired. I feel better now. :)
Here's the graph of the geodesic curvature (upper upper, lower lower):