= Solution
\b[The integral identity requires compactness of $M$, compact support of $X$, or suitable conditions eliminating flux at infinity.] The printed question does not state such a hypothesis. We prove the <Riemannian divergence theorem> for a <compact manifold>, and more generally for a <compactly supported> smooth <vector field> on an oriented <Riemannian manifold> with boundary.
Write $j:\partial M\hookrightarrow M$ for the inclusion. Give $\partial M$ the <outward-normal-first boundary orientation>, and let $N$ be the outward unit <normal vector>. The <Riemannian volume form> of the induced <Riemannian metric> is
$$
\omega_{\widetilde g}=j^*(\iota_N\omega_g).
$$
Indeed, if $(e_1,\ldots,e_{n-1})$ is a positively oriented <orthonormal basis> tangent to the boundary, $(N,e_1,\ldots,e_{n-1})$ is a positively oriented <orthonormal basis> in $M$. Both sides therefore evaluate to one on the boundary basis.
At a boundary point decompose $X=g(X,N)N+X^\top$, where $X^\top$ is tangent to $\partial M$. Evaluating on $n-1$ tangent vectors, the term with $X^\top$ vanishes: all $n$ arguments of the alternating <volume form> then lie in the $(n-1)$-dimensional boundary <tangent space>. Thus the <interior product of a differential form> satisfies
$$
j^*(\iota_X\omega_g)=g(X,N)\,\omega_{\widetilde g}.
$$
The general <Stokes theorem> for an oriented <manifold with boundary> states $\int_M d\eta=\int_{\partial M}j^*\eta$ for any smooth <differential form> $\eta$ of degree $n-1$ with <compact support>; compactness of $M$ makes the support condition automatic. Applying it to $\eta=\iota_X\omega_g$ and using the defining equation for the <divergence of a Riemannian vector field> proves
$$
\boxed{\int_M (\operatorname{div}X)\,\omega_g
=\int_{\partial M}g(X,N)\,\omega_{\widetilde g}.}
$$
For a concrete failure without the extra hypothesis, take $M=[0,\infty)$ with <Riemannian metric> $dx^2$ and $X=(\arctan x)\partial_x$. The <divergence of a Riemannian vector field> is $\operatorname{div}X=(1+x^2)^{-1}$, so
$$
\int_M\operatorname{div}X\,dx=\frac\pi2,
\qquad \int_{\partial M}g(X,N)\,\omega_{\widetilde g}=0,
$$
because $X$ vanishes at the only boundary point. Both integrals are finite. The missing $\pi/2$ is the limiting flux at infinity, so mere integrability of the divergence cannot repair the unrestricted assertion.
Back to article page