Difficult integral involving $\arctan x$ 
Question: Show that$$\int\limits_0^{\infty}\mathrm dx\,\frac {\arctan x\log(1+x^2)}{x(1+x^2)}=\frac {\pi}2\log^22.$$

I can't tell if I'm being an idiot, or if this is a lot more difficult than it looks. First, I tried integration by parts using the fact that $$\frac 1{x(1+x^2)}=\frac 1x-\frac x{1+x^2}.$$
But quickly I gave up as I wasn't sure what to do with the result. I then decided to make the substitution $t=\arctan x$ to get rid of the $1+x^2$ term in the denominator. Therefore$$\begin{align*}\mathfrak{I} & =\int\limits_0^{\pi/2}\mathrm dt\,t\cot t\log\sec^2t=-2\int\limits_0^{\pi/2}\mathrm dt\, t\cot t \log\cos t.\end{align*}$$
However, I'm not exactly sure what to do after this. Should I use integration by parts? Differentiation under the integral sign? I'm having trouble getting started with this integral. Any ideas?
 A: Define
$$ f(a,b) = \int \limits_0^\infty \frac{\arctan(a x) \ln (1+ b^2 x^2)}{x (1+x^2)} \, \mathrm{d} x $$
for $0 \leq a , b \leq 1$ . Then $f(1,1) = \mathfrak{I}$ and $f(0,b) = f(a,0) = 0 $ . For $0< a,b<1$ we can differentiate under the integral sign to find
$$ \partial_a \partial_b f(a,b) = 2 b \int \limits_0^\infty \frac{x^2}{(1+a^2 x^2)(1+b^2 x^2)(1+x^2)} \, \mathrm{d} t = \frac{\pi b}{(1+a)(1+b)(a+b)} \, . $$
The integral can be evaluated using the residue theorem, for example. Now integrate again and exploit the symmetry of the derivative to obtain
\begin{align}
\mathfrak{I} &= f(1,1) = \pi \int \limits_0^1 \int \limits_0^1 \frac{b}{(1+a)(1+b)(a+b)} \, \mathrm{d}a \, \mathrm{d}b = \pi \int \limits_0^1 \int \limits_0^1 \frac{a}{(1+a)(1+b)(a+b)} \, \mathrm{d}a \, \mathrm{d}b \\
&= \frac{\pi}{2} \int \limits_0^1 \int \limits_0^1 \frac{a+b}{(1+a)(1+b)(a+b)} \, \mathrm{d}a \, \mathrm{d}b = \frac{\pi}{2} \int \limits_0^1 \int \limits_0^1 \frac{1}{(1+a)(1+b)} \, \mathrm{d}a \, \mathrm{d}b \\
&= \frac{\pi}{2} \ln^2 (2) \, .
\end{align}
A: Notice:
$$
\Im(\log^2(1+ix))=\Im\left(\left(\frac{1}{2}\log(1+x^2)+i\arctan(x)\right)^2\right)=\frac{1}{2}\log(1+x^2)\arctan(x)
$$
The integral in question is therefore (use parity)
$$
I=\Im\int_{\mathbb{R}}\underbrace{\frac{\log^2(1+ix)}{x(1+x^2)}}_{f(x)}
$$
Integrate around a big semicircle in the lower halfplane (to avoid the branchcut) yields

$$
I=\Im \left(2\pi i\text{Res}(f(z),z=-i)\right)=\frac{\pi}{2}\log^2(2)$$

where the residue is easy to calculate since the pole is simple.
The vansihing of the contrbutions at infinity follows from the fact that $R|f(Re^{i\phi})|\sim \log^2(R)/R^2$ in sector of $\mathbb{C}$ we are interested in.
A: We can use differentiation under the integral sign and a trick to evaluate this. First define
$$ I(a,b) = \int_0^{\infty} \frac{\arctan{ax}}{x} \frac{\log{(1+b^2 x^2)}}{1+x^2} \, dx , $$
so $I(a,0)=I(0,b)=0$ and $I(1,1)$ is what we want. Differentiating one with respect to $a$ and once wrt $b$ gives
$$ \partial_a\partial_b I = \int_0^{\infty} \frac{2bx^2 \, dx}{(1+x^2)(1+a^2x^2)(1+b^2x^2)}, $$
which can be done by using partial fractions and the arctangent integral a few times. When the dust settles,
$$ \partial_a\partial_b I = \frac{b\pi}{(1+a)(1+b)(a+b)}, $$
and thus
$$ I(1,1) = \int_0^1 \int_0^1 \frac{b\pi}{(1+a)(1+b)(a+b)} \, da \, db $$
But we can swap $a$ and $b$ and will get the same result for this integral by the symmetry of the region of integration, so we also have
$$ I(1,1) = \int_0^1 \int_0^1 \frac{a\pi}{(1+a)(1+b)(a+b)} \, da \, db. $$
Adding gives
$$ I(1,1) = \frac{\pi}{2}\int_0^1 \int_0^1 \frac{1}{(1+a)(1+b)} \, da \, db, $$
but this splits into a product of two copies of $\int_0^1 dy/(1+y) = \log{2}$, so
$$ I(1,1) = \frac{\pi}{2}(\log{2})^2 $$
as desired.
