Let \((M,g)\) be a compact Riemannian manifold . Then for \(u\in C^\infty(M)\) and \(X\in \mathfrak{X}(M)\) the integration by parts formula holds
\begin{equation*} \int_{M} \langle \grad u, X\rangle_g dV_g = \int_{\partial M} u\langle X, N\rangle_g dV_{\hat{g}} - \int_{M} u \div X dV_g, \end{equation*}where \(N\) is the outward-pointing unit normal vector along \(\partial M\) and \(\hat{g}\) the induced Riemannian metric on \(\partial M\).
Proof
One obtain this result by using the divergence theorem on \(\div(uX)\) and using the divergence product rule
\begin{equation*} \div(fX)=f\div X+ \langle \grad f, X\rangle_g. \end{equation*}