Picture of the integration step
I found the integration step shown in the picture in a book on quantum mechanics and I really don't understand how it works.
It has to be some magic trick using substitution.
I would solve it using integration by parts, is there any problem with that?
The "magic trick" is "differentiation"!
To find $\frac{\partial^2 e^{-2\lambda x}}{\partial\lambda^2}$, differentiate twice. I presume that you know that the derivative of $e^{a\lambda}$, with respect to $\lambda$, is $ae^{a\lambda}$. Here, $a= -2x$ so the first derivative is $(-2x)e^{-2\lambda x}$. Then the second derivative just does that again: $(-2x)(-2x)e^{-2\lambda x}= 4x^2e^{-2\lambda x}$.
$x^2e^{-2\lambda x}= \frac{1}{4}(4x^2e^{-2\lambda x})$ and they have simply replaced $4x^2e^{-2\lambda x}$ by $\frac{\partial^2 e^{-2\lambda x}}{\partial\lambda^2}$ which is equal to it.