Integral $ \int_{-\infty}^\infty \frac{1}{x^2+1} \left( \tan^{-1} x + \tan^{-1}(a-x) \right) dx$ For $a\in\mathbb R$, I want to evaluate the integral
$$ I = \int_{-\infty}^\infty \frac{1}{x^2+1} \left( \tan^{-1} x + \tan^{-1}(a-x) \right) dx.$$
I tried to integration by parts by considering $\left( \tan^{-1}(x) \right)' = \frac{1}{x^2+1}$, so that
$$I = - \int_{-\infty}^\infty \tan^{-1}(x) \left(\frac{1}{1+x^2} - \frac{1}{1+(x-a)^2}\right).$$
However, I cannot proceed further. Mathematica cannot solve both integrals.
How to evaluate $I$?

We proceed by FShrike's comment. We have
$$\frac{\partial I}{\partial a} = \int \frac{1}{x^2+1} \frac{1}{(a-x)^2+1} dx = \frac{2\pi}{a^2+4}.$$
Since $I(a=0)=0$, we obtain
$$I(a) = \int_0^a \frac{2\pi}{a^2+4}da = \pi \tan^{-1}\frac a2.$$
