Let $M$ be a closed Riemannian manifold and set $X = M \times [0,\infty)$ with the trivial product metric induced.
If $u$ and $v$ are functions defined on $X$, how do I know that the formula $$\int_X u\Delta v = -\int_X \nabla u \nabla v + \int_{\partial X}u\partial_{n}v$$ is true? Here $\partial X = M \times \{0\}$ and $\partial_n$ is the normal derivative, and $\nabla$ and $\Delta$ are the usual operators wrt. the metric on $X$. I guess this formula is sensible for $u$ and $v$ belonging to some Sobolev space, just like usual, right?
Let $\Delta_M$ and $\nabla_M$ be the Laplace-Beltrami operator and the gradient on $M$ and denote the variable on $[0,\infty)$ by $t$. Then $\Delta=\Delta_M+\partial_t^2$ and $\nabla u=(\nabla_Mu,\partial_tu)$. Let me also denote the divergence of a vector field $V$ on $M$ by $\nabla_M\cdot V$.
Assume that $u$ and $v$ are smooth and compactly supported. (This allows the support of $u$ and $v$ to meet the boundary but not to extend to infinity.)
Since $M$ is closed, we have for any fixed $t$ $$ 0 = \int_M\nabla_M\cdot(u\nabla_Mv) = \int_M(\nabla_Mu\cdot\nabla_Mv+u\Delta_Mv). $$ This can be integrated over $t\in[0,\infty)$ to give $$ 0 = \int_{M\times[0,\infty)}(\nabla_Mu\cdot\nabla_Mv+u\Delta_Mv). \tag{1} $$
For any $x\in M$, the fundamental theorem of calculus gives $$ -u(x,0)\partial_tv(x,0) = \int_0^\infty\partial_t(u(x,t)\partial_tv(x,t))dt = \int_0^\infty(\partial_tu(x,t)\partial_tv(x,t)+u(x,t)\partial_t^2v(x,t))dt. $$ Integrating this over $x\in M$ gives $$ -\int_{M\times\{0\}}u\partial_tv = \int_{M\times[0,\infty)}(\partial_tu\partial_tv+u\partial_t^2v). \tag{2} $$
Adding (1) and (2) gives $$ -\int_{M\times\{0\}}u\partial_tv = \int_{M\times[0,\infty)}(\nabla u\cdot\nabla v+u\Delta v), $$ which is what you wanted. To make this hold for more general functions, you only need to approximate them with compactly supported smooth functions. If $u\in H^1$ and $v\in H^2$, then the expressions in the desired formula are well-defined and well-behaved and this approximation argument works.