Solve this integral:$\int_0^\infty\frac{\arctan x}{x(x^2+1)}\mathrm dx$ I occasionally found that $\displaystyle\int_0^{\Large\frac{\pi}{2}}\dfrac{x}{\tan x}=\dfrac{\pi}{2}\ln 2$.
I tried that 
$$\int_0^{\Large\frac{\pi}{2}}\dfrac{x}{\tan x}=\int_0^{\Large\frac{\pi}{2}}x   \ \mathrm d(\ln \sin x)=-\int_0^{\Large\frac{\pi}{2}}\ln (\sin x)=\dfrac{\pi}{2}\ln 2$$
Then I tried another method 
$$\int_0^{\Large\frac{\pi}{2}}\dfrac{x}{\tan x}=\int_0^\infty\dfrac{\arctan x}{x(x^2+1)}\mathrm dx$$
I tried to expand $\arctan x$ and $\dfrac{1}{1+x^2}$, but got nothing, also I was confused that whether $\displaystyle\int_0^\infty$ and $\displaystyle\sum_{i=0}^\infty$ can exchange or not? If yes, on what condition?
Sincerely thanks your help!
 A: Before providing my solution, I'd must admit that Oliver Oloa provides the 
way to calculate this integral. I merely provide a different approach, using Fourier transforms.
First a comment. I tried to use a symmetry argument saying that
$$
\int_0^{+\infty}f(x+1/x)\arctan x\frac{dx}{x}
=\frac{\pi}{4}\int_0^{+\infty} f(x+1/x)\frac{dx}{x},
$$
but I was not able to put this integral into that form. Now to the solution:
Since the integrand is even, our integral equals
$$
\frac{1}{2}\int_{-\infty}^{+\infty}\frac{\arctan x}{x(1+x^2)}\,dx.
$$
We need to know the Fourier transforms
$$
\mathcal F\Bigl[\frac{1}{1+x^2}\Bigr](\xi)=\sqrt{\frac{\pi}{2}}e^{-|\xi|}\quad\text{and}\quad
\mathcal F\Bigl[\frac{\arctan x}{x}\Bigr](\xi)=\sqrt{\frac{\pi}{2}}\int_{|\xi|}^{+\infty}\frac{e^{-t}}{t}\,dt.
$$
By Parseval's formula,
$$
\int_0^{+\infty}\frac{\arctan x}{x(1+x^2)}\,dx=
\frac{1}{2}\sqrt{\frac{\pi}{2}}\sqrt{\frac{\pi}{2}}
\int_{-\infty}^{+\infty} e^{-|\xi|}\int_{|\xi|}^{+\infty} \frac{e^{-t}}{t}\,dt\,d\xi.
$$
The integrand is even in $\xi$, so we get
$$
\frac{\pi}{2}\int_0^{+\infty}e^{-\xi}\int_{\xi}^{+\infty}\frac{e^{-t}}{t}\,dt\,d\xi.
$$
Changing the order of integrations, and calculating the inner one, we get
$$
\frac{\pi}{2}\int_0^{+\infty}\frac{e^{-t}}{t}\int_0^t e^{-\xi}\,d\xi \,dt=
\frac{\pi}{2}\int_0^{+\infty}\frac{e^{-t}}{t}(1-e^{-t})\,dt
$$
Now, the last integral is a Frullani integral that equals $\log 2$, so we
finally get that
$$
\int_0^{+\infty}\frac{\arctan x}{x(1+x^2)}\,dx=\frac{\pi}{2}\log 2.
$$
A: Another chance is given by the following representation associated with the cotangent function
$$ 1-x\cot x=\sum_{n\geq 1}\left(\frac{x}{\pi n-x}-\frac{x}{\pi n+x}\right)\tag{1} $$
that comes from applying $\frac{d}{dx}\log(\cdot)$ to the Weierstrass product for the sine function.
If you integrate both sides of $(1)$ over $\left(0,\frac{\pi}{2}\right)$ the original integral is transformed into a series that is easy to handle through summation by parts and Stirling's inequality. The final outcome is
$$ \int_{0}^{\pi/2}\left(1-x\cot x\right)\,dx = \frac{\pi}{2}\left(1-\log 2\right)\tag{2} $$
that is equivalent to the claim. Anyway, there is a well-known symmetry trick for computing $\int_{0}^{\pi/2}\log\sin(x)\,dx$, that probably gives the slickest approach.
A: $\begin{align} J&=\int_0^\infty\frac{\arctan x}{x(x^2+1)}\mathrm dx\tag1\\
&=\int_0^1\frac{\arctan x}{x(x^2+1)}\mathrm dx+\int_1^\infty\frac{\arctan x}{x(x^2+1)}\mathrm dx
\end{align}$
In the latter integral perform the change of variable $y=\dfrac{1}{x}$,
$\begin{align} J&=\int_0^1\frac{\arctan x}{x(x^2+1)}\mathrm dx+\int_0^1\frac{x\arctan\left(\dfrac{1}{x}\right)}{x^2+1}\mathrm dx\\
&=\left(\int_0^1\frac{\arctan x}{x}\mathrm dx-\int_0^1\frac{x\arctan x}{1+x^2}\mathrm dx\right)+\dfrac{\pi}{2}\int_0^1 \dfrac{x}{x^2+1}dx-\int_0^1\frac{x\arctan x}{x^2+1}\mathrm dx\\
&=\left(\int_0^1\frac{\arctan x}{x}\mathrm dx-2\int_0^1\frac{x\arctan x}{1+x^2}\mathrm dx\right)+\dfrac{\pi}{4}\ln 2
\end{align}$
In $(1)$ perform the change of variable $x=\dfrac{2y}{1-y^2}$,
$\begin{align}
J&=\int_0^1 \dfrac{(1-y^2)\arctan\left(\dfrac{2y}{1-y^2}\right)}{y(1+y^2}dy\\
&=2\int_0^1 \dfrac{(1-y^2)\arctan y}{y(1+y^2}dy\\
&=2\left(\int_0^1\frac{\arctan x}{x}\mathrm dx-2\int_0^1\frac{x\arctan x}{1+x^2}\mathrm dx\right)
\end{align}$
Therefore,
$\displaystyle \int_0^1\frac{\arctan x}{x}\mathrm dx-2\int_0^1\frac{x\arctan x}{1+x^2}\mathrm dx=\dfrac{J}{2}$
Therefore,
$\displaystyle J=\dfrac{J}{2}+\dfrac{\pi}{4}\ln 2$
Finally,
$\boxed{J=\displaystyle \dfrac{\pi}{2}\ln 2}$
A: $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
\int_{0}^{\infty}{\arctan\pars{x} \over x\pars{x^{2} + 1}}\,\dd x & \,\,\,\stackrel{\arctan\pars{x}\ \mapsto\ x}{=}\,\,\,
\int_{0}^{\pi/2}{x \over \tan\pars{x}}\dd x
\\[5mm] & =
\left.\Re\int_{x = 0}^{x = \pi/2}{-\ic\ln\pars{z} \over
\bracks{\pars{z - 1/z}/\pars{2\ic}}/\bracks{\pars{z + 1/z}/2}}
\,{\dd z \over \ic z}\,\right\vert_{\ z\ =\ \exp\pars{\ic x}}
\\[5mm] & =
\left.-\,\Im\int_{x = 0}^{x = \pi/2}{1 + z^{2} \over 1 - z^{2}}\,\ln\pars{z}\,
\,{\dd z \over z}\,\right\vert_{\ z\ =\ \exp\pars{\ic x}}
\\[1cm] & \stackrel{\mrm{as}\ \epsilon\ \to\ 0^{+}}{\sim}\,\,\,
\Im\int_{1}^{\epsilon}{1 - y^{2} \over 1 + y^{2}}
\bracks{\ln\pars{y} + {\pi \over 2}\,\ic}\,{\dd y \over y} +
\Im\int_{\pi/2}^{0}\bracks{\ln\pars{\epsilon} + \ic\theta}\ic\,\dd\theta
\\[2mm] & \phantom{\stackrel{\mrm{as}\ \epsilon\ \to\ 0^{+}}{\sim}\!\!\!}\ +\
\underbrace{\Im\int_{\epsilon}^{1 - \epsilon}
{1 + x^{2} \over 1 - x^{2}}\,\ln\pars{x}\,{\dd x \over x}}_{\ds{=\ 0}}
\\[1cm] & =
-\,{1 \over 2}\,\pi\int_{\epsilon}^{1}{1- x^{2} \over 1 + x^{2}}
\,{\dd x \over x} - {1 \over 2}\,\pi\ln\pars{\epsilon} =
{1 \over 2}\,\pi\int_{\epsilon}^{1}
\pars{1 - {1- x^{2} \over 1 + x^{2}}}\,{\dd x \over x}
\\[1cm] & \stackrel{\mrm{as}\ \epsilon\ \to\ 0^{+}}{\to}\,\,\,
\pi\int_{0}^{1}{x \over x^{2} + 1}\,\dd x = \bbx{{1 \over 2}\,\pi\ln\pars{2}}
\end{align}
A: 
I just want to seek ways that have nothing to do with $\ln (\sin x)$.

Hint. You may consider
$$
I(a):=\int_0^\infty\frac{\arctan (ax)}{x(x^2+1)}\:\mathrm dx,\quad 0<a<1, \tag1
$$
and  obtain
$$
I'(a)=\int_0^\infty\frac1{(x^2+1)(a^2x^2+1)}\:\mathrm dx.
$$ By using partial fraction decomposition, we have
$$
\frac1{(x^2+1)(a^2x^2+1)}=\frac1{\left(1-a^2\right) \left(x^2+1\right)}-\frac{a^2}{\left(1-a^2\right) \left(a^2 x^2+1\right)}
$$ giving
$$
\begin{align}
I'(a)&=\frac1{\left(1-a^2\right)}\int_0^\infty\!\frac1{x^2+1}\:\mathrm dx-\frac{a^2}{\left(1-a^2\right)}\int_0^\infty\frac1{a^2x^2+1}\:\mathrm dx\\\\
&=\frac1{\left(1-a^2\right)}[\arctan x]_0^\infty-\frac{a^2}{\left(1-a^2\right)}\left[\frac{\arctan (ax)}a\right]_0^\infty\\\\
&=\frac1{\left(1-a^2\right)}\frac{\pi}2-\frac{a}{\left(1-a^2\right)}\frac{\pi}2\\\\
&=\frac{\pi}2\frac1{1+a} \tag2
\end{align}
$$ Since $I(0)=0$, by integrating $(2)$, you easily get

$$
\int_0^\infty\frac{\arctan (ax)}{x(x^2+1)}\:\mathrm dx=\frac{\pi}2\: \ln (a+1), \qquad 0\leq a <1,
$$ 

from which, by letting $a \to 1^-$, you deduce

$$
\int_0^\infty\frac{\arctan x}{x(x^2+1)}\:\mathrm dx=\frac{\pi}2 \ln 2
$$ 

as announced.
