Let $(M,g_M)$ be a Riemannian manifold of dimension $n$. Let $f$ be a smooth positive function on $\mathbb R$, and consider $M\times\mathbb R$ equipped with the scaled product metric $$g=f(t)^2 g_M+dt^2,$$ where $dt^2$ is the standard metric on $\mathbb R$.
I have seen the following formula that relates the scalar curvature of $g$ to the scalar curvature of $g_M$:
$$\text{scal}_g=\frac{\text{scal}_{g_M}}{f^2}-2n\left(\frac{f'}{f}\right)'-n(n+1)\left(\frac{f'}{f}\right)^2.$$
Question 1: How would one derive this formula? (A reference would be great if possible.)
The appearance of the terms involving only the scaling function $f$ is curious to me, and I am having some trouble understanding why they should be there. I was thinking of the following simple example. Take $M=(-1,1)$ with its standard metric, and consider the scaled metric on $(-1,1)\times\mathbb R$ equipped with the scaled metric $g$ above defined respect to some function $f$.
Perhaps naively, I am picturing $(-1,1)\times\mathbb R$ as being isometric to the open region $$\left\{(x,y)\in\mathbb R^2\colon -f(x)^2\leq y\leq f(x)^2\right\}\subseteq\mathbb R^2,$$ which is flat. However, the above formula would give
$$\text{scal}_g=-2\left(\frac{f'}{f}\right)'-6\left(\frac{f'}{f}\right)^2,$$
which is not zero in general. This makes me suspect that my picture of $(-1,1)\times\mathbb R$ as a flat region of $\mathbb{R}^2$ is incorrect, and that it should actually be a curved surface in $\mathbb{R}^3$ (maybe part of a surface of revolution, assuming $f$ is bounded above).
Question 2: Is this true? If so, how would one find the correct surface in $\mathbb R^3$ that is isometric to $((-1,1)\times\mathbb{R},g)$?
Regarding your first question
This is a particular case of what we call a warped product manifold. A computation of the Ricci curvature of a warped product metric can be found in Einstein Manifolds, Arthur L. Besse, Proposition 9.106. (careful, there is a typo in equation 9.106(b): this should be $r(U,X)=0$). The equality you are looking for follows by taking the trace.
Regarding your second question
The fact you can parametrize a manifold by a flat domain does not mean that this parametrization is an isometry. Any manifold is locally parametrized by an Euclidean space, but a few of them can be endowed with flat metrics.
For instance, if $S^2$ is the two dimensional sphere of radius $1$, $S^2$ (minus some arc) is parametrized by $(-\pi,\pi)\times (0,\pi)$ with $$ (\theta,\varphi) \longmapsto (\cos\theta \cos \varphi, \sin\theta \cos \varphi, \sin \varphi), $$ and the round metric reads in this coordinates $$ \sin^2\varphi d\theta^2 + d\varphi^2. $$ With this metric, the square $(-\pi,\pi)\times (0,\pi)$ is not flat.
A way of visualizing it is the following: $I\times M$ is a cylinder, where each slice $\{t\}\times M$ is a rescaled version of $M$ (with coefficient $f(t)$). This way, the sphere is seen as a pile of circles: the circles of lattitude.