<s>[INST] Integral $\int_{-\infty}^\infty \frac{\tan^{-1}(x) - \tan^{-1}(x+a)}{(x-i)(x+a-i)} dx$ For $a\in\mathbb R$, I want to compute the integral
$$I = \int_{-\infty}^\infty \frac{\tan^{-1}(x) - \tan^{-1}(x+a)}{(x-i)(x+a-i)} dx.$$
Previously, I asked a question on a similar integral:
Integral $ \int_{-\infty}^\infty \frac{1}{x^2+1} \left( \tan^{-1} x + \tan^{-1}(a-x) \right) dx$
In that question, several ideas, such as (1) taking derivative with respect to $a$ or (2) contour integration, are suggested. However, both method seems to be not working for this integral.
This integral is motivated from physics calculation.
How can I evaluate $I$?
 [/INST] Note that
\begin{align}
I(a)=&\int_{-\infty}^\infty \frac{\tan^{-1}x - \tan^{-1}\overset{x+a\to x}{(x+a)}}{(x-i)(x+a-i)} dx
=\int_{-\infty}^\infty \frac{\tan^{-1}x}{x-i}\Big(\frac{1}{x+a-i}-\frac{1}{x-a-i}\Big) dx
\end{align}
and it is straightforward to verify that $I=I^*$. Thus, it suffices to perform the integration on the real part, which can be expressed as
\begin{align}
J(a)=aI(a)
=& \int_{-\infty}^\infty \tan^{-1}x\Big(\frac{2x}{x^2+1}-\frac{x-a}{(x-a)^2+1} -\frac{x+a}{(x+a)^2+1}\Big) dx\\
 =& \int_{-\infty}^\infty \frac{2x\tan^{-1}- x\tan^{-1}(x-a)-x\tan^{-1}(x+a)} {x^2+1}dx
\end{align}
$$J’(a)=\int_{-\infty}^\infty \frac{x} {(x^2+1)((x-a)^2+1)}-\frac{x} {(x^2+1)((x+a)^2+1)}\> dx=\frac{2\pi a}{a^2+4}
$$
Then
$$I(a)=\frac1a \int_0^a J’(s)ds= \frac1a \int_0^a \frac{2\pi s}{s^2+4}ds= \frac{\pi}{a}\ln\Big(1+\frac{a^2}{4}\Big)
$$
</s>