It is not the case that $$ f_Y(y) = \frac{1}{\pi} e^{-y(x^2+1)}.$$ That is what they gave you for $f_{X,Y}(x,y).$ Furthermore, $f_Y(y)$ should only depend on $y$.
It is given by integrating $f_{X,Y}$ over $x,$ so $$ f_Y(y) = \int_{-\infty}^\infty \frac{1}{\pi} e^{-y(x^2+1)}dx.$$
Simplifying a little, $$ \int_{-\infty}^\infty \frac{1}{\pi} e^{-y(x^2+1)}dx = \frac{1}{\pi}e^{-y} \int_{-\infty}^\infty e^{-yx^2}dx = \frac{2}{\pi}e^{-y} \int_{0}^\infty e^{-yx^2}dx.$$
Then we can use the integral you were given. Substituting $z=\sqrt{y}x$ gives $$ \frac{2}{\pi}e^{-y} \int_{0}^\infty e^{-yx^2}dx=\frac{2}{\pi}e^{-y} \frac{1}{\sqrt{y}}\int_{0}^\infty e^{-z^2}dz=\frac{1}{\sqrt{\pi y}}e^{-y}$$ where $y$ ranges over $(0,\infty).$
Similarly, $$ f_X(x) = \int_0^\infty \frac{1}{\pi}e^{-y(x^2+1)}dy.$$ This is an integral in $y$ so you can just treat the $x^2+1$ as a constant. A run of the mill u substitution gives, $$ \int_0^\infty e^{-ay}dy = \frac{1}{a}$$ for $a>0.$ Thus we have $$ f_X(x)=\frac{1}{\pi}\int_0^\infty e^{-y(x^2+1)}dy = \frac{1}{\pi}\frac{1}{x^2+1}.$$