I am trying to solve $$\int_{-\infty}^\infty \frac{\tan^{-1}x}{x}\ dx$$ using a contour integral.
My Work:
Define a contour $C$ such that:
Now we have $$\int_{C}\frac{\tan^{-1}x}{x}\ dx=\int_{-\infty}^\infty \frac{\tan^{-1}x}{x}\ dx+\int_{\text{Arc}}\frac{\tan^{-1}x}{x}\ dx$$ Now parametizing the integral over the arc: $$\int_{\text{Arc}}\frac{\tan^{-1}x}{x}\ dx=\lim_{R\to \infty}\int_{0}^\pi \frac{\tan^{-1}(Re^{i\theta})}{Re^{i\theta}}iRe^{i\theta}\ d\theta=\lim_{R\to \infty} i\int_{0}^\pi \tan^{-1}(Re^{i\theta})\ d\theta=\frac{i\pi^2}{2}$$ We also note that the entire contour integral does not contain any poles, so it is $0$.
However this is where I run into a problem because that implies:$$\int_{-\infty}^\infty \frac{\tan^{-1}x}{x}\ dx=-\frac{i\pi^2}{2}$$ Which is obviously not true. If anyone can point out why my approach does not work or where I went wrong that would be great. Any help is appreciated.
As the comments have pointed out, the complex function
$$ f(z) = \frac{\arctan z}{z} = \frac{1}{2iz}\ln\frac{1+iz}{1-iz} $$
has two branch points on $z=\pm i$ and a principal branch cut on $(-i\infty,-i)\cup (i,i\infty)$
Since your contour intersects the branch cut, the function is no loner analytic and the closed-loop integral does not equal $0$