Contour integration of $\int_{-\infty}^{\infty} \frac{1-b+x^2}{(1-b+x^2)^2 + 4bx^2}dx = \pi$ Given $0< b <1$, derive the equality:
$\displaystyle \int_{-\infty}^{\infty} \frac{1-b+x^2}{(1-b+x^2)^2 + 4bx^2}dx = \pi$
by integrating the function $(1+z^2)^{-1}$ around the rectangle with  vertices $R, -R, R+i\sqrt{b}, -R+i\sqrt{b}$ for $R>0$ and taking $R \to \infty$. What happens if $b>1$?
Could you give me some help with the 4 integrals that I should evaluate? Also, if there is any other trick I would appreciate it if could give me some help.
 A: Denote $f(z)=\dfrac{1}{1+z^2}$. Consider the anticlockwise contour along the boundary of the rectangle: $-R\stackrel{C_1}{\to} R\stackrel{C_2}{\to} R+i\sqrt{b}\stackrel{C_3}{\to} -R+i\sqrt{b}\stackrel{C_4}{\to} -R$, where $C_i$ $i=1,\dots,4$ are the four oriented edges of the rectangle. Denote $I_i=\int_{C_i}f(z)dz$, $i=1,\dots,4$ and 
$$I=\int_{-\infty}^\infty\frac{1-b+x^2}{(1-b+x^2)^2+4bx^2}d x.$$ 
Express $z$ as $x+iy$. Then $I_1=\int_{-R}^R\frac{1}{1+x^2}d x$, $I_2=\int_{0}^\sqrt{b}\frac{i}{1+(R+iy)^2}d y$, $I_4=-\int_{0}^\sqrt{b}\frac{i}{1+(-R+iy)^2}d y$ and 
$$I_3=-\int_{-R}^R\frac{1}{1+(x+i\sqrt{b})^2}d x=-\int_{-R}^R\frac{1-b+x^2}{(1-b+x^2)^2+4bx^2}d x.$$
Note that $\lim\limits_{R\to\infty}I_2=\lim\limits_{R\to\infty}I_4=0$ and $I=-\lim\limits_{R\to\infty}I_3$.
Since $f$ is holomorphic on $\mathbb{C}\setminus\{\pm i\}$, when $0<b<1$, $f$ is holomorphic on the closure of the rectangle. By Cauchy's integral theorem, $\sum_{i=1}^4 I_i=0$.  Therefore,
$$I=-\lim_{R\to\infty}I_3=\lim_{R\to\infty}I_1=\int_{-\infty}^\infty\frac{1}{1+x^2}d x=\pi.$$
When $b>1$, there is a simple pole $i$ inside the rectangle, so by Cauchy's integral formula, $\sum_{i=1}^4 I_i=\pi$. It follows that 
$$I=-\lim_{R\to\infty}I_3=-(\pi-\lim_{R\to\infty}I_1)=0.$$
A: Note
$$ (1-b+x^2)^2+4bx^2=(1-b+x^2+2\sqrt{b}xi)(1-b+x^2-2\sqrt{b}xi)=[(x+\sqrt bi)^2+1][(x+\sqrt bi)^2+1] $$
and hence
$$ \frac{1-b+x^2}{(1-b+x^2)^2+4bx^2}=\frac12\left(\frac{1}{(x+\sqrt bi)^2+1}+\frac{1}{(x+\sqrt bi)^2+1}\right). $$
It is easy to use contour integral to check
$$ \int_{-\infty}^\infty \frac{1}{(x+\sqrt bi)^2+1}dx=\int_{-\infty}^\infty \frac{1}{(x-\sqrt bi)^2+1}dx=\int_{-\infty}^\infty\frac{1}{x^2+1}dx=\pi.$$
Thus
$$ \int_{-\infty}^\infty \frac{1-b+x^2}{(1-b+x^2)^2+4bx^2}dx=\pi.$$
