Closed form of $\int_0^\infty \arctan^2 \left (\frac{2x}{1 + x^2} \right ) \, dx$ 
Can a closed form solution for the following integral be found:
$$\int_0^\infty \arctan^2 \left (\frac{2x}{1 + x^2} \right ) \, dx\,?$$

I have tried all the standard tricks such as integration by parts, various substitutions, and parametric differentiation (Feynman's trick), but all to no avail.
An attempt is letting
$$f(t):=\int_0^\infty\,\arctan^2\left(\frac{2tx}{1+x^2}\right)\,\text{d}x\,.$$
Therefore,
$$f'(t)=\int_0^\infty\,\frac{8x^2(x^2+1)}{\big(x^4+2(2t^2+1)x^2+1\big)^2}\,\left(1+x^2-4tx\arctan\left(\frac{2tx}{1+x^2}\right)^{\vphantom{a^2}}\right)\,\text{d}x\,.$$
This doesn't seem to go anywhere.  Help!
 A: Here is another solution with a generalization:

Let $r=\sinh\alpha$ and $s=\sinh\beta$. Then
  $$\begin{aligned}
&\int_{0}^{\infty} \arctan\left(\frac{2rx}{1+x^2}\right)\arctan\left(\frac{2sx}{1+x^2}\right) \, \mathrm{d}x\\
&= \pi \left( \alpha \sinh\beta+\beta\sinh\alpha+(\cosh\alpha+\cosh\beta)\log\left(\frac{e^{\alpha}+e^{\beta}}{1+e^{\alpha+\beta}}\right) \right)
\end{aligned} \tag{*}$$

Proof. Let $J = J(\alpha,\beta)$ denote the right-hand side of $\text{(*)}$. Then
$$
J(0, \beta) = 0, \qquad
J_{\alpha}(\alpha, 0) = 0, \qquad
J_{\alpha\beta} = \pi \left( \frac{1+\cosh\alpha\cosh\beta}{\cosh\alpha + \cosh\beta} \right).
$$
Now let $I = I(\alpha, \beta)$ denote the left-hand side of $\text{(*)}$. Then by the substitution $x=\tan(\theta/2)$, we get
$$ I = \frac{1}{2}\int_{0}^{\pi} \frac{\arctan(\sinh\alpha\sin\theta)\arctan(\sinh\beta\sin\theta)}{1+\cos\theta} \, \mathrm{d}\theta. $$
From this, we easily check that $I$ also satisfies
$$ I(0, \beta) = 0, \qquad I_{\alpha}(\alpha, 0) = 0. $$
Moreover,
\begin{align*}
\require{cancel}
I_{\alpha\beta}
&= \frac{1}{2}\int_{0}^{\pi} \frac{\cosh\alpha\cosh\beta(1-\cos\theta)}{(1+\sinh^2\alpha\sin^2\theta)(1+\sinh^2\beta\sin^2\theta)} \, \mathrm{d}\theta \\
&= \frac{1}{2}\int_{0}^{\pi} \frac{\cosh\alpha\cosh\beta}{(1+\sinh^2\alpha\sin^2\theta)(1+\sinh^2\beta\sin^2\theta)} \, \mathrm{d}\theta \\
&\quad - \cancelto{0}{\frac{1}{2}\int_{0}^{\pi} \frac{\cosh\alpha\cosh\beta}{(1+\sinh^2\alpha\sin^2\theta)(1+\sinh^2\beta\sin^2\theta)} \, \mathrm{d}\sin\theta}\\
&= \frac{1}{2}\int_{0}^{\infty} \frac{\cosh\alpha\cosh\beta (1 + t^2)}{(t^2 + \cosh^2\alpha)(t^2 + \cosh^2\beta)} \, \mathrm{d}t \tag{$t=\cot\theta$}
\end{align*}
It is not hard to check that the last integral is equal to $J_{\alpha\beta}$. Therefore we get $I = J$.
A: $$\begin{align*}
I &= \int_0^\infty \arctan^2\left(\frac{2x}{x^2+1}\right) \, dx \\[1ex]
&= \int_0^1 \left(1+\frac1{x^2}\right) \arctan^2\left(\frac{2x}{x^2+1}\right) \, dx \tag1 \\[1ex]
&= 2 \int_0^1 \frac{\arctan^2(x)}{x^2\sqrt{1-x^2}} \, dx \tag{2} \\[1ex]
&= 4 \int_0^1 \frac{\arctan(x) \sqrt{1-x^2}}{x(1+x^2)} \, dx \tag{3} \\[1ex]
&= 4 \left(\underbrace{\int_0^1 \frac{\sqrt{1-x^2}}x \arctan(x) \, dx}_{J_1} - \underbrace{\int_0^1 \frac{x\sqrt{1-x^2}}{x^2+1} \arctan(x) \, dx}_{J_2}\right) \tag{4}
\end{align*}$$

$$\begin{align*}
J_1 &= \sum_{n=0}^\infty \frac{(-1)^n}{2n+1} \int_0^1 x^{2n} \sqrt{1-x^2} \, dx & \tag{5} \\[1ex]
&= \frac12 \sum_{n=0}^\infty \frac{(-1)^n}{2n+1} \int_0^1 x^{n-\frac12} (1-x)^{\frac12} \, dx \tag{6} \\[1ex]
&= \frac12 \Gamma\left(\frac32\right) \sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)} \frac{\Gamma\left(n+\frac12\right)}{\Gamma(n+2)} \tag{7} \\[1ex]
&= \frac{\sqrt\pi}4 \sum_{n=0}^\infty \frac{(-1)^n}{(n+1)(2n+1)} \frac{\Gamma\left(n+\frac12\right)}{\Gamma(n+1)} \tag{8} \\[1ex]
&= \frac{\sqrt\pi}2 \sum_{n=0}^\infty \frac{(-1)^n}{2n+1} \frac{(2n)!}{2^{2n}(n!)^2} - \frac{\sqrt\pi}4 \sum_{n=0}^\infty \frac{(-1)^n}{n+1} \frac{(2n)!}{2^{2n}(n!)^2} \tag{4/9} \\[1ex]
&= \frac\pi2 (\operatorname{arsinh}(1) + 1 - \sqrt2) \tag{10}
\end{align*}$$

$$\begin{align*}
J_2 &= \int_0^1 \int_0^1 \frac{x^2 \sqrt{1-x^2}}{(x^2+1)(1+y^2x^2)} \, dy \, dx \tag{11} \\[1ex]
&= \frac\pi2 \int_0^1 \frac{(\sqrt2-1)y^2+1-\sqrt{y^2+1}}{y^2(y^2-1)} \, dy \tag{12} \\[1ex]
&= \frac\pi{2\sqrt2} \left(\sqrt2 - 2 + \log(2)\right)
\end{align*}$$

Putting these together, we arrive at
$$I = \boxed{\pi\bigg(2\operatorname{arsinh}(1)-\sqrt2 \log(2)\bigg)}$$


*

*$(1)$ : substitute $x\mapsto\dfrac1x$ in the integral over $[1,\infty)$

*$(2)$ : substitute $x\mapsto\dfrac{1+\sqrt{1-x^2}}x$

*$(3)$ : integrate by parts

*$(4)$ : partial fractions

*$(5)$ : series expansion of $\arctan(x)$

*$(6)$ : substitute $x\mapsto\sqrt x$

*$(7)$ : beta function

*$(8)$ : $\Gamma(n+1)=n\,\Gamma(n)$

*$(9)$ : convert gammas to factorials in preparation for ...

*$(10)$ : series expansion of $\operatorname{arsinh}(x)$

*$(11)$ : integral definition of $\arctan(x)$

*$(12)$ : the last integral is elementary
A: $$I=\int_0^\infty \arctan^2 \left (\frac{2x}{x^2 + 1} \right ) dx\overset{IBP}=4\int_0^\infty \frac{x(x^2-1)\arctan\left(\frac{2x}{x^2+1}\right)}{x^4+6x^2+1}dx$$
We have that: $$4\int\frac{x(x^2-1)}{x^4+6x^2+1}dx=(\sqrt 2 +1)\ln(x^2+(\sqrt 2+1)^2)-(\sqrt 2-1)\ln(x^2+(\sqrt 2-1)^2)$$
$$\frac{d}{dx}\arctan\left(\frac{2x}{x^2+1}\right)=\frac12\left(\frac{\sqrt 2+1}{x^2+(\sqrt 2+1)^2}-\frac{\sqrt 2-1}{x^2+(\sqrt 2-1)^2}\right)$$
Thus integrating by parts again and simplifying we obtain:
$$I=\int_0^\infty \frac{(\sqrt 2+1)^2 \ln(x^2+(\sqrt 2+1)^2)}{x^2+(\sqrt 2+1)^2}dx+\int_0^\infty \frac{(\sqrt 2-1)^2 \ln(x^2+(\sqrt 2-1)^2)}{x^2+(\sqrt 2-1)^2}dx$$
$$-\int_0^\infty \frac{\ln(x^2+(\sqrt 2-1)^2)}{x^2+(\sqrt 2+1)^2}dx-\int_0^\infty \frac{\ln(x^2+(\sqrt 2+1)^2)}{x^2+(\sqrt 2-1)^2)}dx$$
From here we have the following result:
$$\int_0^\infty \frac{\ln(x^2+a^2)}{x^2+b^2}dx=\frac{\pi}{b}\ln(a+b), \ a,b>0$$
So using this result and with some algebra everything simplifies to: 
$$\boxed{\int_0^\infty \arctan^2 \left (\frac{2x}{x^2 + 1} \right ) dx=2\pi \ln(1+\sqrt 2)-\sqrt 2\pi \ln 2}$$
A: Here is a solution based on Fubini's theorem.
According to an addition formula
\begin{equation*}
 \arctan\left(\dfrac{2x}{1+x^2}\right) = \arctan((\sqrt{2}+1)x)-\arctan((\sqrt{2}-1)x) .
\end{equation*}
Furthermore
\begin{equation*}
 \arctan x=\mathrm{sign}(x)\dfrac{\pi}{2}-\arctan\dfrac{1}{x} .
\end{equation*}
Consequently
\begin{equation*}
  \arctan\left(\dfrac{2x}{1+x^2}\right)  = \arctan\dfrac{\sqrt{2}+1}{x}-\arctan\dfrac{\sqrt{2}-1}{x}=\int_{\sqrt{2}-1}^{\sqrt{2}+1}\dfrac{x}{x^2+s^2}\, ds .
\end{equation*}
Via Fubini's theorem we get
\begin{gather*}
\int_{0}^{\infty}\arctan^2\left(\dfrac{2x}{1+x^2}\right)\, dx = \int_{0}^{\infty}\left(\arctan\dfrac{\sqrt{2}+1}{x}-\arctan\dfrac{\sqrt{2}-1}{x}\right)^2\, dx=\\[2ex]
\int_{0}^{\infty}\left(\int_{\sqrt{2}-1}^{\sqrt{2}+1}\dfrac{x}{x^2+s^2}\, ds\int_{\sqrt{2}-1}^{\sqrt{2}+1}\dfrac{x}{x^2+t^2}\, dt\right)\, dx=\\[2ex]
\int_{\sqrt{2}-1}^{\sqrt{2}+1}\left(\int_{\sqrt{2}-1}^{\sqrt{2}+1}\left(\int_{0}^{\infty}\dfrac{x^2}{(x^2+s^2)(x^2+t^2)}\, dx\right)\, ds\right)\, dt=\\[2ex]
\dfrac{\pi}{2}\int_{\sqrt{2}-1}^{\sqrt{2}+1}\left(\int_{\sqrt{2}-1}^{\sqrt{2}+1}\dfrac{1}{s+t}\, ds\right)\, dt=\\[2ex]
\dfrac{\pi}{2}\int_{\sqrt{2}-1}^{\sqrt{2}+1}\left(\ln(t+\sqrt{2}+1)-\ln(t+\sqrt{2}-1)\right)\, dt=\\[2ex]
2\pi\ln(\sqrt{2}+1)-\sqrt{2}\pi\ln 2.
\end{gather*}
Remark.
Since
\begin{equation*}
 \arctan\left(\dfrac{2x\sinh\alpha}{1+x^2}\right)=\arctan\left(\dfrac{e^{\alpha}}{x}\right)-\arctan\left(\dfrac{e^{-\alpha}}{x}\right) = \int_{e^{-\alpha}}^{e^{\alpha}}\dfrac{x}{x^2+s^2}\, ds 
\end{equation*}
the $@$Sangchul Lee's generalization can be proved in the same way.
