Einstein equation and scalar field stress-energy tensor Let's have interaction between gravitational and scalar real fields. For an action of gravitational field in vacuum I add term $S_{m} = \int d^{4}x\sqrt{-g}L_{m}$, where
$$
L_{m} = \frac{1}{2}g^{\mu \nu}\partial_{\mu}\varphi \partial_{\nu} \varphi - V(\varphi )
$$ 
So the variation $\delta S_{m}$ must give $\frac{1}{2}\int d^{4}x \sqrt{-g}\delta (g^{\mu \nu})T_{\mu \nu}$, where $T_{\mu \nu}$ refers to the stress-energy tensor of scalar real field. I tried to do it, but this leads me to the answer
$$
\delta S_{m} = \int d^{4}x\delta (\sqrt{-g})L_{m} + 
$$
$$
+\int d^{4}x \sqrt{-g}\left(\frac{1}{2}\delta (g^{\mu \nu})\partial_{\mu} \varphi \partial_{\nu} \varphi - g^{\mu \nu} \partial_{\mu}\varphi \partial_{\nu} \delta \varphi - \frac{\partial V( \varphi )}{\partial \varphi }\delta \varphi\right)=
$$
$$
=\frac{1}{2}\int d^{4}x\sqrt{-g}\delta (g^{\mu \nu})T_{\mu \nu} + \int d^{4}x\sqrt{-g}\left( g^{\mu \nu} \partial_{\mu}\varphi \partial_{\nu} \delta \varphi - \frac{\partial V( \varphi )}{\partial \varphi }\delta \varphi\right).
$$
What to do with the second integral? Does it equal to zero according to Euler-Lagrange equation, or I can't say so?
 A: The expression for $\delta S_m$ that you're expecting holds provided the variation you are performing is the variation with respect to the inverse metric only; there should be no $\delta\varphi$ terms.  In other words; set $\delta\varphi = 0$, and you obtain the desired expression.
See, for example, Carroll Spacetime and Geometry p.164, he does the same computation and explicitly remarks

"Now vary this action with respect, not to $\phi$, but to the inverse metric..."

Generally speaking, in fact, the stress tensor is defined to be proportional to the functional derivative of the action with respect to the inverse metric;
\begin{align}
  T_{\mu\nu} = -2\frac{1}{\sqrt{-g}}\frac{\delta S}{\delta g^{\mu\nu}}
\end{align}
A: Variations of the action must be performed with respect the field of which you want to get the equations of motion. You have varied with respect the metric field and the $\phi$ field at the same time. What have you done is not strictly incorrect, since the variations are independent, but led you in confusion. In fact, you are not sure how to behave. However, you can apply Euler-Lagrange equation for the field $\phi$ and then reach the conclusion (as well as put $\delta \phi = 0$ since you are not varying with respect to $\phi$).
