compute one improper integral involving arctangent Compute $$\int_{0}^{\infty} \frac{\arctan(ax)}{x(1+x^{2})}dx$$
The answer is:
$\frac{\pi}{2}\ln(1+a)$ when $a \geq 0$
$-\frac{\pi}{2}\ln(1-a)$ when $a < 0$

Here is my problem, and I can't even dive into a appropriate first step. The most difficult part is the $\arctan$ which I have no idea to eliminate. Thank you for help.

 A: Another approach is to consider $ \displaystyle f(z) = \frac{\ln(1-iaz)}{z(1+z^{2})}$ (where $ a \ge 0$) and integrate around a contour on the complex plane that consists of the line segment $[-R,R]$ and the upper half of the circle $|z|=R$.
As $ R \to \infty$, $ \displaystyle \int f(z) \ dz$ vanishes along the upper half of $|z|=R$.
Therefore,
$$ \begin{align}  \int_{-\infty}^{\infty} \frac{\ln |1-iax| - i \arctan (ax) }{x(1+x^{2})} \ dx &= \int_{-\infty}^{\infty} \frac{\frac{1}{2}\ln(1+a^{2}x^{2}) - i \arctan(ax)}{x(1+x^{2})} \ dx \\  &= 2 \pi i \ \text{Res}[f(z),i] \\ &=  2 \pi i \ \lim_{z \to i} \frac{\ln(1-iaz)}{z(z+i)} \\  &= - i \pi \ln(1+a) . \end{align}$$
But
$$ \begin{align} \int_{-\infty}^{\infty} \frac{\frac{1}{2}\ln (1+a^{2}x^{2}) - i \arctan (ax) }{x(1+x^{2})} \ dx &= \int_{-\infty}^{\infty} \frac{\frac{1}{2}\ln(1+a^{2}x^{2})}{x(1+x^{2})} \ dx - i \int_{-\infty}^{\infty} \frac{\arctan (ax)}{x(1+x^{2})} \ dx \\  &= 0 - 2i \int_{0}^{\infty} \frac{\arctan (ax)}{x(1+x^{2})} \ dx \\ &=  -2i \int_{0}^{\infty} \frac{\arctan (ax)}{x(1+x^{2})} \ dx \end{align}$$
since the first integrand is odd and the second integrand is even.
So we have
$$ -2i \int_{0}^{\infty} \frac{\arctan (ax)}{x(1+x^{2})} \ dx = - i \pi \ln(1+a)$$
which implies
$$ \int_{0}^{\infty} \frac{\arctan (ax)}{x(1+x^{2})} \ dx = \frac{\pi}{2} \ln(1+a) \ , \ a \ge 0.$$
But since $\arctan$ is an odd function,
$$ \int_{0}^{\infty} \frac{\arctan (ax)}{x(1+x^{2})} \ dx = \frac{\pi}{2} \text{sgn}(a) \ln(1+|a|) .$$
A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
\begin{align}&\color{#c00000}{\int_{0}^{\infty}
{\arctan\pars{ax} \over x\pars{1+x^{2}}}\,\dd x}
=\half\,a\verts{a}\int_{-\infty}^{\infty}
{\arctan\pars{x} \over x\pars{x^{2} + a^{2}}}\,\dd x
\\[3mm]&=\half\,a\verts{a}\int_{-\infty}^{\infty}\
\overbrace{{\ic \over 2}\,\ln\pars{1 - \ic x \over 1 + \ic x}}
^{\ds{=\ \arctan\pars{x}}}\
{1\over x\pars{x^{2} + a^{2}}}\,\dd x
=-\,\half\,a\verts{a}\,\Im\int_{-\infty}^{\infty}
{\ln\pars{1 - \ic x} \over x\pars{x^{2} + a^{2}}}\,\dd x
\end{align}

Set $\ds{t \equiv 1 - \ic x\quad\imp\quad x = \pars{t - 1}\ic}$:
  \begin{align}&\color{#c00000}{\int_{0}^{\infty}
{\arctan\pars{ax} \over x\pars{1+x^{2}}}\,\dd x}
=-\,\half\,a\verts{a}\,\Im\int_{1 + \infty\ic}^{1 - \infty\ic}
{\ln\pars{t} \over \pars{t - 1}\ic\bracks{-\pars{t - 1}^{2} + a^{2}}}\,\ic\,\dd t
\\[3mm]&=-\,\half\,a\verts{a}\,\Im\color{#00f}{%
\int_{1 - \infty\ic}^{1 + \infty\ic}{\ln\pars{t}\over
\pars{t - 1}\pars{t - r_{-}}\pars{t - r_{+}}}\,\dd t}
\quad \mbox{where}\quad r_{\pm} = 1 \pm \verts{a}
\end{align}

Now, we'll evaluate the $\ds{\color{#00f}{\mbox{'blue integral'}}}$.
We take the "$\ds{\ln}$-branch cut" along the negative $\ds{t}$-semi-axis and close the contour in a semi-circle "to the right" $\ds{\pars{~t > 1~}}$: 
\begin{align}&\color{#c00000}{\int_{0}^{\infty}
{\arctan\pars{ax} \over x\pars{1+x^{2}}}\,\dd x}
=-\,\half\,a\verts{a}\,\Im\bracks{-2\pi\ic\,
{\ln\pars{r_{+}} + \ic 0 \over \pars{r_{+} - 1}\pars{r_{+} - r_{-}}}}
\\[3mm]&=\pi\,a\verts{a}\,\bracks{%
{\ln\pars{1 + \verts{a}} \over \verts{a}\pars{2\verts{a}}}}
\end{align}

$$
\color{#66f}{\large\int_{0}^{\infty}
{\arctan\pars{ax} \over x\pars{1+x^{2}}}\,\dd x
={\pi \over 2}\,\sgn\pars{a}\ln\pars{1 + \verts{a}}}
$$

A: You want to evaluate
$$ I(a) = \int_0^\infty\! dx\,\frac{\arctan(a x)}{x (1+x^2)}.$$
It is easy to see (because $\arctan(0)=0$) that $I(0)=0$. Moreover, we have 
$$I'(a)= \int_0^\infty \!dx \frac{1}{(1+x^2)(1+ a^2 x^2)}.$$
The last integral can be integrated by standard methods (e.g. partial fraction expansion), and we obtain
$$I'(a) = \frac{a \arctan(a x) -\arctan(x)}{a^2 -1}\Bigg|_{x=0}^\infty
 = \frac{\pi}2 \frac{|a| -1}{a^2-1}
= \frac{\pi}2 \frac{1}{1 +|a|}.   $$
Another integration yields the final result
$$I(a)= \int_0^a\!db\,I'(b) = \frac{\pi}2 \int_0^a\!db\,(1+|b|)^{-1}
= \frac\pi2 \mathop{\rm sgn}(a)\ln(1+|a|).$$
