The integral of the mean curvature vector over a closed immersed surface

The result is in fact true for arbitrary codimensions. See Lemma 2.1 in this paper. A very quick proof taken from that paper:

Let $\Sigma \subset \mathbb{R}^n$ be some immersed submanifold. Let $X$ be a vector field on $\mathbb{R}^n$. We can decompose locally $X = X_t + X_n$ the tangential and normal componens to $\Sigma$. By definition we have that for $Y$ tangent to $\Sigma$

$$ \partial_Y X_t = \nabla_Y X_t + h(X_t,Y) $$

and

$$ \partial_Y X_n = - A_{X_n}(Y) + \nabla^\perp_Y X_n $$

where $\nabla$ is the induced Levi-Civita connection, and $\nabla^\perp$ is the induced normal connection. $h$ is the second fundamental form and $A$ is the Weingarten map associated to $X_n$: $\langle Z, A_{X_n}(Y)\rangle = \langle - h(Y,Z), X_n\rangle$

Suppose $X$ is a parellel vector field on $\mathbb{R}^n$. $\partial_Y X = 0$. This implies that $\nabla_Y X_t = - A_{X_n}(Y)$. Using the definition of the Weingarten map, we have that the $g$-trace of $\nabla X_t = \operatorname{div} X_t$ is equal to $\langle H, X\rangle$. So we have that if $\Sigma$ is a closed manifold, by the divergence theorem, $\int_\Sigma \langle H,X\rangle d\mu = 0$ if $X$ is a parallel, hence constant, vector field on $\mathbb{R}^n$.


One could also note the following: while the notion of $\int_\Sigma H d\mu$ is not well-defined for $\Sigma$ isometrically immersed in an arbitrary Riemannian manifold $M$, because there is no canonical vector space in which the $H$, evaluated at different points in $\Sigma$, all live. But if instead we consider the version where instead we treat $\int_\Sigma \langle H,X\rangle d\mu$, we see that for any $X$ a vector field in $M$ defined along $\Sigma$ such that $X$ is parallel along $\Sigma$, we have the same conclusion.


For immersions into $R^3$ (rather than arbitrary codimension) there is basically a one-line proof:

$$2\int_\Sigma HN dA = \int_\Sigma df \wedge dN = \int_\Sigma d(fdN) = \int_{\partial\Sigma = \emptyset} f dN = 0.$$

Here $N$ is the Gauss map associated with the immersion $f: M \to \mathbb{R}^3$. The relationship $df \wedge dN = 2HNdA$ is also not hard: let $\kappa_i$ be the curvatures associated with principal directions $X_i$, so that $dN(X_i)=\kappa_i df(X_i)$. Then

$$df \wedge dN(X_1,X_2) = df(X_1) \times dN(X_2) - df(X_2) \times dN(X_1) = (\kappa_1 + \kappa_2) df(X_1) \times df(X_2) = 2HNdA(X_1,X_2).$$

(Note that here the wedge product uses the cross product $\times$ to define an algebra on $\mathbb{R}^3$, i.e., $\alpha \wedge \beta(X,Y) := \alpha(X) \times \beta(Y) - \alpha(Y) \times \beta(X)$.)