Integrate $\int_0^\infty \frac{dx}{(x^2+2x+12)^2}$ using residues I want to find the integral
$$I=\int_0^\infty \frac{dx}{(x^2+2x+12)^2}$$
using contour integration; I am familiar with the trigonometric substitution in real analysis.
There are no branch cuts, there are two second order poles at $z=-1\pm\sqrt{11}i$. I cannot use $\int_{-\infty}^\infty=2\int_0^\infty$ since the function isn't even.
Clearly, the choice of contour is important here (compare with this question). I tried half-circle and quarter-circle contours, but they just give some weird rationals. Is there some better contour here? Am I missing something?
 A: Yes.  There is a standard trick for integrating functions over $[0,\infty)$, and that is to exploit the multi-valuedness of the logarithm about a branch cut.  Thus, consider
$$\oint_C dz \frac{\log{z}}{(z^2+2 z+12)^2} $$
where $C$ is a keyhole contour as pictured below:

The radius of the small circle is $\epsilon$ and that of the bigger circle is $R$.  The contour integral over $C$ is then
$$\int_{\epsilon}^R dx \frac{\log{x}}{(x^2+2 x+12)^2} + i R \int_0^{2 \pi} d\theta \, e^{i \theta}\frac{\log{\left ( R e^{i \theta} \right )}}{\left (R^2 e^{i 2 \theta} + 2 R e^{i \theta}+12 \right )^2} \\ + \int_R^{\epsilon} dx \frac{\log{x} + i 2 \pi}{(x^2+2 x+12)^2} + i \epsilon \int_{2 \pi}^0 d\phi \, e^{i \phi} \frac{\log{\left ( \epsilon e^{i \phi} \right )}}{\left (\epsilon^2 e^{i 2 \phi}+ 2 \epsilon e^{i \phi}+12 \right )^2}$$
It should be evident that, as $R \to \infty$, the second integral vanishes as $\log{R}/R^3$, and that as $\epsilon \to 0$, the fourth integral vanishes as $\epsilon \log{\epsilon}$.  Thus, in this limit, the contour integral is
$$-i 2 \pi \int_0^{\infty} \frac{dx}{(x^2+2 x+12)^2} $$
By the residue theorem, this contour integral is also equal to $i 2 \pi$ times the sum of the residues at the poles $z_{\pm} = -1 \pm i \sqrt{11}$.  Therefore we have
$$\begin{align}\int_0^{\infty} \frac{dx}{(x^2+2 x+12)^2} &= - \left [\frac{d}{dz} \frac{\log{z}}{(z-z_-)^2} \right ]_{z=z_+} - \left [\frac{d}{dz} \frac{\log{z}}{(z-z_+)^2} \right ]_{z=z_-}\\ &= -\frac1{z_+ (z_+-z_-)^2} + \frac{2 \log{z_+}}{ (z_+-z_-)^3}\\ &-\frac1{z_- (z_--z_+)^2} + \frac{2 \log{z_-}}{(z_--z_+)^3} \\ &= -\frac{z_++z_-}{z_- z_+ (z_+-z_-)^2} + 2 \frac{\log{z_+}-\log{z_-}}{(z_+-z_-)^3} \end{align}$$
To get this right, it is crucial that we understand how to compute the logs.  Understand that, in defining the contour, we demanded that $\arg{z} \in [0,2 \pi)$.  Thus, 
$$\log{z_+} = \frac12 \log{12} + i \left (\pi- \arctan{\sqrt{11}}\right )$$
$$\log{z_-} = \frac12 \log{12} +i \left (\pi+ \arctan{\sqrt{11}}\right )$$
Putting this altogether, we find, after some arithmetic, that
$$\int_0^{\infty} \frac{dx}{(x^2+2 x+12)^2} = \frac{1}{22 \sqrt{11}} \arctan{\sqrt{11}} - \frac1{264} $$
ADDENDUM
Another way of evaluating this integral is to observe that
$$\int_0^{\infty} \frac{dx}{(x^2+2 x+b)^2} = -\frac{\partial}{\partial b} \int_0^{\infty}  \frac{dx}{x^2+2 x +b} $$
then consider
$$\oint_C dz \frac{\log{z}}{z^2+2 z+b} $$
The analysis is the same as above; the result is that
$$-\int_0^{\infty} \frac{dx}{x^2+2 x +b} = \frac{\log{z_+}-\log{z_-}}{z_+-z_-} = -\frac{\arctan{\sqrt{b-1}}}{\sqrt{b-1}}$$
Differentiating, we get
$$\int_0^{\infty} \frac{dx}{(x^2+2 x+b)^2} = \frac{\arctan{\sqrt{b-1}}}{2 (b-1)^{3/2}}-\frac{1}{2 b (b-1)}$$
Plugging in $b=12$ produces the above result.
