I have the following integral:
$$ \int_{-\infty}^{\infty}\frac{x^2+b}{(x-1)^3(x+1)^3}dx, $$
which I want to solve by complex integration (is it possible? That's my first question).
Now, by using the following contour:
$$ C_R=[-R,-1-\epsilon]\cup\{-1+\epsilon e^{i\theta};0\leq\theta\leq\pi\}\cup[-1+\epsilon,1-\epsilon]\cup\{1+\epsilon e^{i\theta};0\leq\theta\leq\pi\}\cup[1+\epsilon,R], $$
so that
$$ \oint_{C_R}f(z)dz=0, $$
and in the limits as $R\to\infty$ and $\epsilon\to0$:
$$ \int_{-\infty}^{\infty}\frac{x^2+b}{(x-1)^3(x+1)^3}=-\lim_{\epsilon\to0}(\text{integrals on the semi-circles}). $$
For the semicircle around $x=-1$, let $z=-1+\epsilon e^{i\theta}$, so that:
$$ \text{integral semi-circle 1}=\int_\pi^0\frac{(-1+\epsilon e^{i\theta})^2+b}{(-1+\epsilon e^{i\theta}-1)^3(-1+\epsilon e^{i\theta}+1)^3}(i \epsilon e^{i\theta}d\theta)=\frac{i}{\epsilon^2}\int_\pi^0 e^{i\theta}\frac{(-1+\epsilon e^{i\theta})^2+b}{(-2+\epsilon e^{i\theta})^3(e^{i\theta})^3}d\theta, $$
which diverges in the limit as $\epsilon\to0$, just like the other remaining integral.
The latter makes sense when one looks at the plot of $f(x)$.
But, on the other hand, the corollary in this post (if I understood it correctly) implies that:
$$ \lim_{\epsilon\to0}\text{integral semi-circle 1}=i\pi\text{Res}(z_0=-1)=\frac{1}{16}(1-3b), $$
and then
$$ \lim_{\epsilon\to0}(\text{integrals on the semi-circles})=0, $$
which contradicts the first result.
What am I missing?
Thanks.