TITLE: How to perform this contour integration with $\log$ in the denominator?
QUESTION [6 upvotes]: Let $k > 0$ and $ a>1$ be constants. As far as I can tell, the integral
$$
J = \int_{-\infty}^\infty dx\frac{e^{i k x}}{1+x^2}\frac{1}{\log(a - ix)}
$$
converges, since the argument of the logarithm never equals $1$ and is never a nonpositive real number. Calculating it using a contour in the upper half-plane, I find that it equals
$$
2\pi i \frac{e^{-k}}{2i}\frac{1}{\log(a+1)}= \frac{\pi \,e^{-k}}{\log(a+1)}.
$$
Clearly this expression is not valid if $k < 0$, because the integral should not blow up. For $k < 0$, we would like to use a contour in the lower half-plane. But the logarithm has a branch point $z = -i a$ there. Can we calculate the integral for $k < 0$ using complex analysis or otherwise?

REPLY [4 votes]: Verification
Since the integrand vanishes in the extremes of the upper half-plane, close the path of integration in the upper half-plane.
$$
\gamma=[-R,R]\cup Re^{i[0,\pi]}
$$
The branch point of $\log(a-ix)$ is at $-ia$ which is outside $\gamma$.
The integral along the circular part of $\gamma$ vanishes as $R\to\infty$, leaving us with
$$
\begin{align}
\int_{-\infty}^\infty\frac{e^{ikx}}{1+x^2}\frac{\mathrm{d}x}{\log(a-ix)}
&=2\pi i\operatorname*{Res}_{z=i}\left(\frac{e^{ikz}}{1+z^2}\frac1{\log(a-iz)}\right)\\
&=2\pi i\frac{e^{-k}}{2i}\frac1{\log(a+1)}\\
&=\frac{\pi e^{-k}}{\log(a+1)}
\end{align}
$$
So your integral appears correct.

Negative $\boldsymbol{k}$
We can do the same thing for negative $k$, except we need to add a slit along $(-ia,-i\infty)$ for the branch cut and include the residue from the singularity at $-i(a-1)$. If we parametrize the slit as $z=-ix$, then we have $\log(a-iz)=\log(x-a)+i\pi$ on the left of the slit and $\log(a-iz)=\log(x-a)-i\pi$ on the right. Then
$$
\begin{align}
&\overbrace{\int_{-\infty}^\infty\frac{e^{ikx}}{1+x^2}\frac{\mathrm{d}x}{\log(a-ix)}}^{\text{part along the real line ($z=x$)}}
\overbrace{-i\int_a^\infty\frac{e^{kx}}{1-x^2}\left(\frac1{\log(x-a)+i\pi}-\frac1{\log(x-a)-i\pi}\right)\mathrm{d}x}^{\text{part around the slit ($z=-ix$)}}\\
&=\int_{-\infty}^\infty\frac{e^{ikx}}{1+x^2}\frac{\mathrm{d}x}{\log(a-ix)}
+\int_a^\infty\frac{e^{kx}}{x^2-1}\frac{2\pi}{\log(x-a)^2+\pi^2}\mathrm{d}x\\
&=-2\pi i\operatorname*{Res}_{z=-i}\left(\frac{e^{ikz}}{1+z^2}\frac1{\log(a-iz)}\right)-2\pi i\operatorname*{Res}_{z=-i(a-1)}\left(\frac{e^{ikz}}{1+z^2}\frac1{\log(a-iz)}\right)\\
&=-2\pi i\frac{e^{k}}{-2i}\frac1{\log(a-1)}-2\pi i\frac{e^{k(a-1)}}{a(2-a)}i\\
&=\frac{\pi e^k}{\log(a-1)}+\frac{2\pi e^{k(a-1)}}{a(2-a)}
\end{align}
$$
Therefore, for $k\le0$,
$$
\begin{align}
&\int_{-\infty}^\infty\frac{e^{ikx}}{1+x^2}\frac{\mathrm{d}x}{\log(a-ix)}\\
&=\frac{\pi e^k}{\log(a-1)}+\frac{2\pi e^{k(a-1)}}{a(2-a)}-\int_a^\infty\frac{e^{kx}}{x^2-1}\frac{2\pi}{\log(x-a)^2+\pi^2}\mathrm{d}x
\end{align}
$$
When $k=0$, this equals $\frac\pi{\log(a+1)}$. However, for $k\lt0$, this does not equal $\frac{\pi e^{-k}}{\log(a+1)}$.