Compute $\int_{-\infty}^{\infty} \frac{x^{2}}{(1+x^{4})^{2}} dx$ using residues I've been trying to integrate 
$$\int_{-\infty}^{\infty} \frac{x^{2}}{(1+x^{4})^{2}} dx$$
by using residues. 
So I understand the set up of this problem by doing:
$$\int_{-R}^{R} \dfrac{x^{2}}{(1+x^{4})^{2}} dx  + \int_{C_R} \dfrac{z^{2}}{(1+z^{4})^{2}} dz $$ 
where $C_{R}$ is the upper circle in the complex plane. 
So when applying Cauchy's residue theorem, I am finding the resides of 
$f(z) =  \dfrac{z^{2}}{(1+z^{4})^{2}} $ at $z= e^{\pi/4i}$ and $z= e^{ 3\pi /4 i}$ since they are within the upper circle in the complex plane. However, they are poles of order 2 and the algebra seems complicated. Anyone have any suggestion to find the residues of $f(z)$ at the poles?  
 A: By recognizing that the integrand is symmetric and real on the imaginary line, one can halve the amount of residues required using
$$\int_{-\infty}^\infty\frac{x^2}{(1+x^4)^2}~\mathrm dx=2\int_0^\infty\frac{x^2}{(1+x^4)^2}~\mathrm dx=2\Re\oint_C\frac{z^2}{(1+z^4)^2}~\mathrm dz$$
where $z$ is a quarter circle over the first quadrant. Since the pole at $z=\omega_8=\exp(\pi i/4)$ is a second order pole, the residue is given by
$$\underset{z=\omega_8}{\operatorname{Res}}\frac{z^2}{(1+z^4)^2}=\lim_{z\to\omega_8}\frac{\mathrm d}{\mathrm dz}\frac{z^2(z-\omega_4)^2}{(1+z^4)^2}=-\frac1{16}\omega_8^3$$
and hence
$$\int_{-\infty}^\infty\frac{x^2}{(1+x^4)^2}~\mathrm dx=-\frac\pi4\Re(i\omega_8^3)=\frac\pi{4\sqrt2}$$
A: Let$$h(z)=\frac z{(z-e^{3\pi i/4})(z-e^{5\pi i/4})(z-e^{7\pi i/4})}.$$With a few computations, you get that $h(e^{\pi i/4})=-\frac i4$ and that $h'(e^{\pi i/4})=\frac{e^{\pi i/4}}8$. So, near $e^{\pi i/4}$, you have$$h(z)=-\frac i4+\frac{e^{\pi i/4}}8\left(z-e^{\pi i/4}\right)+\cdots\tag1$$Now, let $g(z)=h^2(z)$. It follows from $(1)$ that, near $e^{\pi i/4}$, you have$$g(z)=-\frac1{16}-\frac{e^{3\pi i/4}}{16}\left(z-e^{\pi i/4}\right)+\cdots$$and so (again, near $e^{\pi i/4}$),\begin{align}f(z)&=\frac{g(z)}{\left(z-e^{\pi i/4}\right)^2}\\&=-\frac1{16}\left(z-e^{\pi i/4}\right)^{-2}-\frac{e^{3\pi i/4}}{16}\left(z-e^{\pi i/4}\right)^{-1}+\cdots\end{align}Therefore,$$\operatorname{res}_{z=e^{\pi i/4}}f(z)=-\frac{e^{3\pi i/4}}{16}$$and a similar computation shows that$$\operatorname{res}_{z=e^{3\pi i/4}}f(z)=-\frac{e^{\pi i/4}}{16}$$So\begin{align}\int_{-\infty}^\infty\frac{x^2}{(1+x^4)^2}\,\mathrm dx&=2\pi i\left(-\frac{e^{3\pi i/4}}{16}-\frac{e^{\pi i/4}}{16}\right)\\&=\frac\pi{4\sqrt2}.\end{align}
