Evaluating $\int_0^{\infty} {y^2 \cos^2(\frac{\pi y}{2}) \over (y^2-1)^2} dy$ I´m having trouble with the following integral
$$
\int_0^{\infty} {y^2 \cos^2(\frac{\pi y}{2}) \over (y^2-1)^2} dy
$$
I have tried lots of approaches and nothing works. Mathematica says it does not converge but that is not true. It appears in a Physical problem (it is the energy of a system) and the answer should be (by conservation of energy): $\frac{\pi^2}{8}$ but I cannot show it. 
 A: Let $I$ denote the integral. Then
\begin{align*}
I &= \frac{1}{2} \int_{-\infty}^{\infty} \frac{y^2 \cos^{2} (\pi y/2)}{(y^{2} - 1)^{2}} \, dx \\
&= \frac{1}{4} \int_{-\infty}^{\infty} \frac{y^2 (1 + \cos \pi y)}{(y^{2} - 1)^{2}} \, dx \\
&= \frac{1}{4} \Re \mathrm{PV}\!\!\int_{-\infty}^{\infty} \frac{y^2 (1 + e^{i\pi y})}{(y^{2} - 1)^{2}} \, dx.
\end{align*}
Now considering an upper-semicircular contour with two vanishing upper-semicircular indents at $z = \pm 1$, it follows that
\begin{align*}
\mathrm{PV}\!\!\int_{-\infty}^{\infty} \frac{z^2 (1 + e^{i\pi z})}{(z^{2} - 1)^{2}} \, dz
&= \pi i \left( \mathrm{Res}_{z=-1} \frac{z^2 (1 + e^{i\pi z})}{(z^{2} - 1)^{2}} + \mathrm{Res}_{z=1} \frac{z^2 (1 + e^{i\pi z})}{(z^{2} - 1)^{2}} \right) \\
&= \pi i \left( -\frac{i\pi}{4} -\frac{i\pi}{4} \right) \\
&= \frac{\pi^{2}}{2}.
\end{align*}
Therefore the conclusion follows.
A: \begin{align*}
I
&=
{1 \over 2}\int_{-\infty}^{\infty}
{y^2 \cos^{2}\left(\pi y/2\right)
 \over
 \left(y^{2} - 1\right)^{2}}\,{\rm d}y
=
{1 \over 8}\int_{-\infty}^{\infty}y\cos^{2}\left(\pi y/2\right)\left\lbrack%
{1 \over \left(y - 1\right)^{2}}
-
{1 \over \left(y + 1\right)^{2}}
\right\rbrack
\,{\rm d}y
\\[5mm]&=
{1 \over 8}\int_{-\infty}^{\infty}y\cos^{2}\left(\pi y/2\right)\left\lbrack%
{1 \over \left(y - 1\right)^{2}}
+
{1 \over \left(y - 1\right)^{2}}
\right\rbrack
\,{\rm d}y
=
{1 \over 4}\int_{-\infty}^{\infty}{y\cos^{2}\left(\pi y/2\right) \over \left(y - 1\right)^{2}}
\,{\rm d}y
\\[5mm]&=
{1 \over 4}\int_{-\infty}^{\infty}{\sin^{2}\left(\pi y/2\right) \over y^{2}}
\,{\rm d}y
=
{1 \over 4}\int_{0}^{\pi}{\rm d}\pi'\,{1 \over 2}\int_{-\infty}^{\infty}
{\sin\left(\pi' y\right) \over y}
\,{\rm d}y
=
{\pi \over 8}\int_{-\infty}^{\infty}{\sin\left(y\right) \over y}\,{\rm d}y
\\[5mm]&=
{\pi \over 8}\int_{-\infty}^{\infty}\,{\rm d}y\,
{1 \over 2}\int_{-1}^{1}\,{\rm d}k\,{\rm e}^{{\rm i}ky}
=
{\pi^{2} \over 8}\int_{-1}^{1}\,{\rm d}k\,
\int_{-\infty}^{\infty}\,{{\rm d}y \over 2\pi}\,{\rm e}^{{\rm i}ky}
=
{\pi^{2} \over 8}\int_{-1}^{1}\,{\rm d}k\,\delta\left(k\right)
=
{\Large{\pi^{2} \over 8}}
\end{align*}
