<s>[INST] A improper integral with complex parameter For a complex number $\displaystyle z$, How to evaluate
$$\int_0^\infty\frac{\text{d}x}{x^2+(1-z^2x^2)^2}$$
 [/INST] By the quadratic formula, the denominator of the integrand has roots
$$\begin{align}
r_1,r_2,r_3,r_4 &= \pm\sqrt{\frac{2z^2-1\pm\sqrt{1-4z^2}}{2z^4}}\\
&=\frac{\pm1}{2z^2}\left(i\pm\sqrt{4z^2-1}\right)
\end{align}$$
and since the integrand is an even function,
$$\begin{align}
\int_0^\infty \frac{dx}{x^2+(1-z^2x^2)^2} &= \frac{1}{2}\int_{-\infty}^\infty \frac{dx}{x^2+(1-z^2x^2)^2} \\
&= \frac{1}{2}\int_{-\infty}^\infty \frac{1/z^4}{x^4+(1-2z^2)x^2/z^4+1/z^4} dx \\
&= \frac{1}{2z^4}\int_{-\infty}^\infty f(x) dx
\end{align}$$
where $$f(x) = \frac{1}{(x-r_1)(x-r_2)(x-r_3)(x-r_4)}.$$  Since $f(z)$ is analytic in the upper half complex plane (except for a finite number of poles), and since $f(z)$ vanishes faster than $1/z^2$ for $|z|\rightarrow\infty$, the residue theorem gives $$\frac{1}{2z^4}\int_{-\infty}^\infty f(x)dx = \frac{\pi i}{z^4}\sum\mathrm{res\,\,}f$$ where $\sum\mathrm{res\,\,}f$ is the sum of the residues in the upper-half plane.  The trick then is to determine which of the four poles are on the upper half plane.  We define the roots as
$$\begin{align}
r_1 &= \frac{1}{2z^2}\left(i+\sqrt{4z^2-1}\right) \\
r_2 &= -r_1 \\
r_3 &= \frac{1}{2z^2}\left(i-\sqrt{4z^2-1}\right) \\
r_4 &= -r_3
\end{align}$$
If $z$ is purely real, then $r_1$ and $r_3$ are in the upper half plane.  Thus
$$\begin{align}
\sum\mathrm{res\,\,}f &= \frac{1}{(r_1-r_2)(r_1-r_3)(r_1-r_4)} + \frac{1}{(r_3-r_1)(r_3-r_2)(r_3-r_4)} \\
&= -i\frac{z^4}{2}
\end{align}$$
after much algebra.  Therefore we have
$$\begin{align}
\int_0^\infty \frac{dx}{x^2+(1-z^2x^2)^2} &= \frac{\pi i}{z^4}\frac{-iz^4}{2} \\
&= \frac{\pi}{2}
\end{align}$$
which is independent of $z$ (if $z$ is purely real)!  In the general case, however, compute the residues of the poles that are in the upper half plane, to be determined by the value of $z$.
</s>