Stoke's theorem in Einstein-Hilbert action When using the method of action variation to establish GR field equation in one of the steps we use Stock's theorem on an arbitrary manifold to show that one of the terms contributes nothing to the variation wrt the inverse metric. See for example the Wikipedia entry on Einstein-Hilbert action.
Most texts that I read, without writing the actual steps of calculations, simply say that variation at infinity vanishes and hence the above mentioned term vanishes.
Can someone please do the actual calculation involving the application of Stoke's theorem for an arbitrary manifold here, which I do no see in textbooks, as I am confused, in particular, are we assuming the variation of the inverse metric or its covariant derivative to be zero at infinite timelike or spacelike coordinates?
 A: Last year I signed for a course in GR and had to present a seminar on the ADM formalism, and many things puzzled me. What you're asking was one of them.
In deriving the Einstein-Hilbert action the standard procedure is to ignore boundary terms without saying why. The fact is that if space is boundary-free or has definite boundary conditions, this contribution may vanish, but that's not the general rule: as the metric must remain non-degenerate not all of its components can reach zero in any limit. As this puzzles you and me, it also puzzled people like Hawking and York, and their conclusion was that in general spacetime manifolds the appropriate action is not the Einstein-Hilbert one, but what we today call the Gibbons–Hawking–York action. It is simply the Einstein-Hilbert action plus a boundary term which is intrinsically (and unavoidably) connected to the ADM formalism of GR, since it depends on the induced metric and the extrinsic curvature tensor. 
In resume: if you're anxious about throwing away the boundary contribution, you are on the right track: it is a fake simplification, and those terms are very important in many areas. In fact, besides the ADM formalism and asymptotic infinities, the book by Bojowald mentions that the boundary terms in GR are associated to symmetrical criticality. Since I don't work with GR I'm not sure of how important those subjects are, but probably important enough for you to read a little about those boundary terms. Bojowald was the best reference I found when I was studying this subject.
