Solution (source code)

= Solution

For <integration by parts>, take $u=\arctan x$ and $dv=x^{-2}\,dx$. Then $du=dx/(1+x^2)$ and $v=-1/x$, so
$$
\int\frac{\arctan x}{x^2}\,dx=-\frac{\arctan x}{x}+\int\frac{dx}{x(1+x^2)}.
$$
Use <partial fraction decomposition> $1/[x(1+x^2)]=1/x-x/(1+x^2)$. Therefore
$$
\boxed{\int\frac{\arctan x}{x^2}\,dx=-\frac{\arctan x}{x}+\ln|x|-\frac12\ln(1+x^2)+C,\qquad x\ne0.}
$$
The <constant of integration> may be chosen independently on the positive and negative intervals.