$\int_0^{\infty}\frac{1}{(x+1)(x^2+1)}dx$ using complex analysis I was hoping to use the Residue Theorem, but I'm not sure what contour to use; I was thinking that since $$\frac{1}{(z+1)(z^2+1)}=\frac{z-1}{z^4-1},$$ it would make sense to choose a quarter circle around the origin, as then the denominator has a simple expression on both straight-line components of the integral. Unfortunately the singularity at $z=i$ is then on the contour. Any ideas for a better contour?
 A: Too long for a comment.
It is possible to evaluate this integral via integration in the complex plane. I would do the following:

*

*choose the function $f(z)=\frac{z^a}{(z+1)(z^2+1)}$ ($a$ is a small parameter; $a\to0$ in the end)

*take the keyhole contour (below) with the cut from zero along the positive part of axis $X$ (we need it to make the function single-valued)




*Integral along a big circle $\to0$ as $R\to \infty$ (function decreases rapidly enough)

*Integral along a small circle (around zero) $\to0$ as $r\to0$

*Integral along the upper bank of the cut is the desired integral $I= \int_0^\infty\frac{z^a}{(x+1)(x^2+1)}dx$

*Integral along the lower  bank of the cut is integral $-Ie^{2\pi ia}$ (minus is due to integration in the negative direction, and the factor $e^{2\pi ia}$ - due to the full turn counter-clockwise around the branch point $z=0$)

You will get $I(1-e^{2\pi ia})=2\pi i Res _{(z=-1, i, -i)}\frac{z^a}{(z+1)(z^2+1)}$ - residuals in three simple poles inside the contour.
At the end you will have to take the limit $a\to0$ (uncovering the uncertainty). All this program is not too much complicated.
