Converting to a complex integral and evaluating with Residue theorem So I'm running into this problem as I'm trying to evaluate this integral:
$$ \int_0^{\infty} \frac{dx}{x^4+4x^2+4} $$

My work:
$$ \int_0^{\infty} \frac{dx}{x^4+4x^2+4} \rightarrow \frac{1}{2}\int_{-\infty}^{\infty} \frac{dz}{z^4+4z^2+4} $$
The poles of $z^4+4z^2+4=0$ are: $z= -i \sqrt{2},-i \sqrt{2},i \sqrt{2},i \sqrt{2}$
$$ \rightarrow \frac{1}{2}\int_{-\infty}^{\infty} \frac{dz}{(z -i \sqrt{2})^2 (z +i \sqrt{2})^2} = \frac{1}{2}(2\pi i \sum \text{residues}) $$
$$ Res(i \sqrt{2}) = \lim_{z\rightarrow i \sqrt{2}}(z -i \sqrt{2}) f(z) = \lim_{z\rightarrow i \sqrt{2}} \frac{(z -i \sqrt{2})}{(z -i \sqrt{2})^2 (z +i \sqrt{2})^2} = \lim_{z\rightarrow i \sqrt{2}} \frac{1}{(z -i \sqrt{2}) (z +i \sqrt{2})^2} = -\infty $$

I don't think this is right? How should I be evaluating this integral so I don't get the nasty business of $\frac{1}{0}$?

Any advice on how to tackle this would be appreciated.

EDIT: I wasn't using the formula for higher order poles, thanks for pointing it out everyone
You have a pole of order $2$ in $i\sqrt{2}$ then the residue there is
$$\lim_{z\to i\sqrt{2}}\left((z-i\sqrt{2})^2\frac{1}{z^4+4z^2+4}\right)'=-i\dfrac{\sqrt{2}}{16}$$
do this with other poles!
writing your integral in the form:
$$\int_{0}^\infty \frac{1}{(x^2+2)^2}dx$$
Substitute $$x=\sqrt{2}\tan(u)$$ then we get
$$\sqrt{2}\int_{0}^{\pi/2}\frac{\cos^2(u)}{4}du$$ and this is equal to
$$\frac{1}{2\sqrt{2}}\frac{1}{2}\cos(2u)+\frac{1}{2}du$$
substutute $2u=s$ then we have
$$\frac{1}{8\sqrt{2}}\int_{0}^\pi\cos(s)ds+\frac{1}{4\sqrt{2}}\int_{0}^\frac{\pi}{2}1du$$ and this is equal to
$$\lim_{b\to \pi^-}\frac{\sin(b)}{8\sqrt{2}}+\frac{1}{4\sqrt{2}}\int_{0}^{\frac{\pi}{2}}1du$$ since the first Limit is Zero we get
$$\lim_{b\to \frac{\pi^-}{2}}\frac{u}{4\sqrt{2}}|_{0}^b=\frac{\pi}{8\sqrt{2}}$$