Evaluating$ \int_{-\infty}^{\infty} \frac{x^6}{(4+x^4)^2} dx $using residues I need help to solve the next improper integral using complex analysis:
$$  \int_{-\infty}^{\infty} \frac{x^6}{(4+x^4)^2} dx $$
I have problems when I try to find residues for the function $ f = \displaystyle \frac{1}{(z^4+4)^2}$.
This is what I tried.
$$\displaystyle \text{res}(f,\sqrt{2}e^{i\left(\frac{\pi}{4}+k\frac{\pi}{2} \right)}) = \lim_{z\to \sqrt{2}e^{i\left(\frac{\pi}{4}+k\frac{\pi}{2} \right)}} \left( \frac{\left(z-\sqrt{2}e^{i\left(\frac{\pi}{4}+k\frac{\pi}{2} \right)}\right)^2}{(z^4-4)^2}\right)'$$
with $k\in\{0,1,2,3\}$. What do you think about it?
I know there is a little more general problem involving this integral; for all $a>0$
$$ \int_{-\infty}^{\infty} \frac{x^6}{(a^4+x^4)^2} dx= \frac{3\pi\sqrt{2}}{8a}  $$
Edit.

I've had an idea: from the integration by parts
$$\int u dv = uv - \int vdu$$
and if we let 
$$ dv = \frac{4x^3 }{(4+x^4)^2}, \, u = \frac{x^3}{4}$$
with 
$$dv = -\frac{d}{dx} \frac{1}{4+x^4} = \frac{4x^3 }{(4+x^4)^2}$$
we get finally
$$ \int_{-\infty}^{\infty} \frac{x^6}{(4+x^4)^2} dx = 0 + \frac{3}{4} \int_{-\infty}^{\infty}  \frac{x^2}{1+x^4} dx $$
which I think is more easy to solve.
Anyway, if you know another idea or how to complete my first try will be welcome.
 A: If you are right, then $\int_{-\infty}^{\infty}  \frac{x^2}{1+x^4} dx$ can be easily done by a semi-circle contour, computing the residues at $(1+i)/\sqrt{2}$ and $(-1+i)/\sqrt{2}$. It is easy to check that the integral of $\frac{z^2}{1+z^4}$ on the arc of the semi-circle goes to 0.
$\frac{z^2}{1+z^4}=\frac{z^2}{(z-e^{i\pi/4})(z-e^{i3\pi/4})(z-e^{i5\pi/4})(z-e^{i7\pi/4})}$ shows that it is a simple pole at those residues.
$\text{ Res}(\frac{z^2}{1+z^4},e^{i\pi/4})=\lim_{z\to e^{i\pi/4}}\frac{z^2(z-e^{i\pi/4})}{1+z^4}=\lim_{z\to e^{i\pi/4}}\frac{3z^2-2ze^{i\pi/4}}{4z^3}=(\frac{3}{4}-\frac{1}{2})e^{-i\pi/4}$.
$\text{ Res}(\frac{z^2}{1+z^4},e^{i3\pi/4})=\lim_{z\to e^{i3\pi/4}}\frac{z^2(z-e^{i3\pi/4})}{1+z^4}=\lim_{z\to e^{i3\pi/4}}\frac{3z^2-2ze^{i3\pi/4}}{4z^3}=(\frac{3}{4}-\frac{1}{2})e^{-i3\pi/4}$.
I used L'Hospital's rule above because it seems simpler.
So the answer is $\int_{-\infty}^{\infty}  \frac{x^2}{1+x^4} dx=2\pi i\frac{1}{4}\left(\frac{1-i}{\sqrt{2}}+\frac{-1-i}{\sqrt{2}}\right)=\frac{\sqrt{2}}2\pi$.
Edit: Something's wrong with the integration by parts; we do not seem to get the right answer. It is a 4 in the bottom and not 1. But we can do a further substitution to get it right.
$\int_{-\infty}^{\infty} \frac{x^2}{4+x^4} dx=\frac{1}{\sqrt{2}} \int_{-\infty}^{\infty} \frac{1}{\sqrt{2}}\frac{(\frac{x}{\sqrt{2}})^2}{1+(\frac{x}{\sqrt{2}})^4} dx=\frac{1}{\sqrt{2}}\int_{-\infty}^{\infty} \frac{x^2}{1+x^4} dx$.
So the final answer is $\int_{-\infty}^{\infty} \frac{x^6}{(4+x^4)^2} dx=\frac{3}{4}\int_{-\infty}^{\infty} \frac{x^2}{4+x^4} dx=\frac{3}{8}\pi$. You also have to argue that you are limiting $r\to\infty$ in $\left[\frac{x^3}{4(4+x^4)}\right]_{-r}^r$ which is why it is 0.
