Evaluating $\mathcal{P}\int_0^\infty \frac{dx}{(1 + a^2x^2)(x^2 - b^2)}$ I am trying to evaluate this integral 
$$\mathcal{P}\int_0^\infty \frac{dx}{(1 + a^2x^2)(x^2 - b^2)}$$
with $\mathcal{P}$ the principal value and $a,b>0$.
I already know the answer to be $$ - \frac{a\pi}{2(1 + a^2b^2)}$$
after fiddling with Mathematica putting numbers for $a$ and $b$.
The poles of this function are at $x=\pm b, \pm \frac{i}{a^2}$ so I cannot find a proper contour.
Any help in getting the answer will be appreciated!
 A: I believe you can take the following contour: (ignore the orange dashed lines for now)

Why I think it works-


*

*All residues are computable

*the integral along the $\color{red}{\text{red}}$ line goes to 0 for large radius $R\to\infty$, since the integrand is like $R^{-4}$.

*The integral along the $\color{blue}{\text{blue}}$ parts gives twice your answer, since the integral is an even function of $x$ (since $x^2 = (-x)^2$)

*The integral along both the $\color{green}{\text{green}}$ semicircles around $\pm b$ is actually equal to the integral along both the $\color{orange}{\text{orange}}$ contours, due to the same symmetry as the above bullet point (180º rotation, $z^2 = (-z)^2$). So they are half the residues at $\pm b$.


Therefore, setting $f(z) := \frac1{(1 + a^2z^2)(z^2 - b^2)}$,
$$ 2\mathcal{P}\int_0^\infty \frac{dx}{(1 + a^2x^2)(x^2 - b^2)} = 2\pi i \left( \operatorname{Res}(f;i/a) + \frac12 \operatorname{Res}(f;-b) + \frac12 \operatorname{Res}(f;b) \right) $$
The rest of it should be easy. The partial fraction decomposition
$$\frac1{(1 + a^2z^2)(b^2 - x^2)} =  \frac{-a^2}{(a^2 b^2 + 1) (a^2 x^2 + 1)} + \frac1{2 b (a^2 b^2 + 1) (x - b)} - \frac1{2 b (a^2 b^2 + 1) (b + x)}
$$should be useful.
A: Use that $$\frac{1}{(1+a^2x^2)(x^2-b^2)}=1/2\,{\frac {1}{ \left( 1+{a}^{2}{b}^{2} \right) b \left( -b+x
 \right) }}-{\frac {{a}^{2}}{ \left( 1+{a}^{2}{b}^{2} \right)  \left( 
1+{a}^{2}{x}^{2} \right) }}-1/2\,{\frac {1}{ \left( 1+{a}^{2}{b}^{2}
 \right) b \left( b+x \right) }}
$$
A: Thanks to both of you for the help!
So indeed, this contour is a good one to evaluate this integral.
The residues at $b$ and $-b$ just cancel each other.
The residue at $i/a$ gives $$ - \frac{a}{2i\left( a^2 b^2 +1 \right)}$$
Thus we have
$$ 2\mathcal{P}\int_0^\infty \frac{dx}{(1 + a^2x^2)(x^2 - b^2)} = 2\pi i \left(- \frac{a}{2i\left( a^2 b^2 +1 \right)} \right) =  \frac{-\pi a}{1 + a^2b^2}$$
$$ \mathcal{P}\int_0^\infty \frac{dx}{(1 + a^2x^2)(x^2 - b^2)} = -\frac{\pi}{2}\frac{a}{1 + a^2b^2}$$
