TITLE: $\int_{0}^{\infty}\frac{1}{(x+e)(\ln^{2}x + 4\pi^{2})} \, dx$: Keyhole Contour Omitting Positive Axis
QUESTION [5 upvotes]: Compute $$\int\limits_{0}^{\infty}\frac{1}{(x+e)(\ln^{2}x + 4\pi^{2})} \, dx$$

Using the substitution $u = \sqrt{x}$ we see that
\begin{align*}
\int\limits_{0}^{\infty}\frac{1}{(x+e)(\ln^{2}x + 4\pi^{2})} \, dx =\frac{1}{2} \int_{0}^{\infty} \frac{u}{(u^{2}+e)(\ln^{2}u + \pi^{2})} \, du
\end{align*}
Now let $f(z) = \frac{z}{(z^{2}+e)\ln z}$ with  branch cut along the positive real axis and $-\pi \leq \arg z < \pi$. Let $\gamma$ be the following contour:

Going by residues, we have that
$$\oint_{\gamma} f(z) \, dz = 2\pi i \left(\frac{2}{1+\pi^{2}} + \frac{1}{1+e}\right)$$
The same tricks as always show that the contributions from $\gamma_{R}$ and $\gamma_{r}$ will vanish as $R$ goes to infinity and $r$ goes to 0. Now
\begin{align*}
&\oint_{\gamma} f(z) \, dz = \oint_{\gamma_{\varepsilon}} f(z) \, dz + \oint_{\gamma_{-\varepsilon}} f(z) \, dz \\
=& \int_{0}^{\infty} \frac{u+i\varepsilon}{((u+i\varepsilon)^{2}+e)(\ln (u+i\varepsilon)}\, du - \int_{0}^{\infty} \frac{u-i\varepsilon}{((u-i\varepsilon)^{2}+e)(\ln (u-i\varepsilon))}\, du
\end{align*}
Taking $\varepsilon$ to $0$
$$= 2\pi i \int_{0}^{\infty}\frac{u}{(u^{2}+e)(\ln^{2} u + \pi^{2})} \, du $$
Putting it all together, we finally see that
$$\int\limits_{0}^{\infty}\frac{1}{(x+e)(\ln^{2}x + 4\pi^{2})} \, dx = \frac{1}{2}\left(\frac{2}{1+\pi^{2}} + \frac{1}{1+e}\right) $$
The professor said everything is good except that I put $\arg z \in [-\pi, \pi)$. I'm taking the positive real axis to the angle $-\pi$ and going all the way around comes to $\pi$. This issue is fixed by taking $0 \leq \arg z < 2\pi$ and changing $\ln z$ to $(\ln z - \pi i)$ in the denominator. This example does something weird and I think similar to what I did. Can someone explain why what I did wasn't okay? I don't really understand.

REPLY [2 votes]: You should really use a contour about the negative real axis.  That way, when you consider
$$\oint_C dz \frac{z}{(z^2+e) \log{z}} $$
where $C$ is the keyhole contour about the negative real axis, we get that it is equal to
$$e^{i \pi} \int_{\infty}^0 dx \frac{-x}{(x^2+e) (\log{x}+i \pi)} + e^{-i \pi} \int_0^{\infty} dx \frac{-x}{(x^2+e) (\log{x}-i \pi)}$$
Note, here $\arg{z} \in [-\pi,\pi)$.  I have assigned the phase to be $+\pi$ above the negative real axis and $-\pi$ below.  Combining these integrals gives you the integral you seek.
You may apply the residue theorem since the poles at $z=\pm i \sqrt{e}$ and $z=1$ all lie within $C$.  (You would have had a complication with your original contour.)  
I get that
$$\int_0^{\infty} \frac{dx}{(x+e)(\log^2{x}+4 \pi^2)} = \frac12 \frac1{1+e} +  \frac1{1+\pi^2} $$