Integrate $\int_{0}^{\infty}\frac{\tan^{-1}x}{x\left(1+x^{2}\right)}dx$ Q:

Integrate $I=\int_{0}^{\infty}\frac{\tan^{-1}x}{x\left(1+x^{2}\right)}dx$

My Approach:
Put $$\tan^{-1}x=t\to x=\tan t$$
Also we have, $$\frac{dx}{1+x^{2}}=dt$$
We get, $$I=\int_{0}^{\frac{\pi}{2}}\frac{t}{\tan t}dt$$
I'm stuck here, how do I proceed further? I tried integration by parts but it doesn't seem to work out for me.
Edit: I tried again and I got the answer 
 A: Integrating by parts we have
$$I=\int_{0}^{\frac{\pi}{2}}\frac{t}{\tan (t)}dt=\int_{0}^{\frac{\pi}{2}}\frac{t\cos(t)}{\sin(t)}dx$$
$$=t\ln(\sin(t))\big|_{0}^{\frac{\pi}{2}}-\int_{0}^{\frac{\pi}{2}}\ln(\sin(t))dt=0-\left(-\frac{\pi}{2}\ln(2)\right)=\frac{\pi}{2}\ln(2)$$
using the result from here.
A: Alternatively
\begin{align}
\int_{0}^{\infty}\frac{\tan^{-1}x}{x\left(1+x^{2}\right)}dx
&=\int_0^\infty \frac1{1+x^2}\left( \int_0^1 \frac1{1+x^2 y^2}dy\right)dx\\
 &=\int_0^1 \int_0^\infty \frac1{(1+x^2)(1+x^2 y^2)}dx\>dy\\
&=\frac\pi2  \int_0^1 \frac1{1+y}dy=\frac\pi2\ln2
\end{align}
A: Another way using Feynmann trick
$$\frac d {da}\int_0^\infty \frac{\tan ^{-1}(a x)}{x \left(x^2+1\right)}\,dx=\int_0^\infty \frac{dx}{\left(x^2+1\right) \left(a^2 x^2+1\right)}$$
$$\frac{1}{\left(x^2+1\right) \left(a^2 x^2+1\right)}=\frac{a^2}{\left(a^2-1\right) \left(a^2x^2+1\right)}-\frac{1}{\left(a^2-1\right) \left(x^2+1\right)}$$
$$\int \frac{dx}{\left(x^2+1\right) \left(a^2 x^2+1\right)}=\frac{a \tan ^{-1}(a x)-\tan ^{-1}(x)}{a^2-1}$$
Assuming $a>0$
$$\int_0^\infty \frac{dx}{\left(x^2+1\right) \left(a^2 x^2+1\right)}=\frac \pi{2(1+a)}$$ Integrating from $0$ to $1$ then
$$\int_0^\infty \frac{\tan ^{-1}( x)}{x \left(x^2+1\right)}\,dx=\frac{1}{2} \pi  \log (2)$$ and making it more general
$$\int_0^\infty \frac{\tan ^{-1}(k x)}{x \left(x^2+1\right)}\,dx=\frac{1}{2} \pi  \log (k+1)$$
A: We are going to evaluate the integral in a general form using Feynman’s Technique Integration by letting
$ \displaystyle I(a)=\int_{0}^{\infty} \frac{\tan ^{-1}(a x)}{x\left(x^{2}+b^{2}\right)} d x \text {, where } a, b \geqslant 0\tag*{} $
Differentiating $ I(a)$ w.r.t $ a$ yields
$ \begin{aligned}I^{\prime}(a) &=\int_{0}^{\infty} \frac{d x}{\left(1+a^{2} x^{2}\right)\left(x^{2}+b^{2}\right)} \\ \displaystyle &=\frac{1}{a^{2} b^{2}-1} \int_{0}^{\infty}\left(\frac{a^{2}}{1+a^{2} x^{2}}-\frac{1}{x^{2}+b^{2}}\right) d x \\ \displaystyle &=\frac{1}{a^{2} b^{2}-1}\left[a \tan ^{-1}(a x)-\frac{1}{b} \tan ^{-1}\left(\frac{x}{b}\right)\right]_{0}^{\infty} \\&=\frac{\pi}{2\left(a^{2} b^{2}-1\right)}\left(a-\frac{1}{b}\right) \\&=\frac{\pi}{2 b(a b+1)} \\ \displaystyle I(a) &=\frac{\pi}{2 b} \int \frac{d a}{a b+1} \end{aligned} \tag*{} $
Hence
$ \displaystyle \begin{array}{l} \displaystyle I(a)=\frac{\pi}{2 b^{2}} \ln (a b+1)+c \\ \displaystyle 0=I(0)=0+c \Rightarrow c=0 \end{array} \tag*{} $
We can conclude that
$\displaystyle \boxed{ \int_{0}^{\infty} \frac{\tan ^{-1}(a x)}{x\left(x^{2}+b^{2}\right)} d x  =\frac{\pi}{2 b^{2}} \ln (a b+1)}\tag*{} $
When $a=b=1$, $$
\int_{0}^{\infty} \frac{\tan ^{-1} x}{x\left(1+x^{2}\right)} d x=\frac{\pi}{2} \ln 2
$$
A: $$\begin{align*}
\int_0^\infty \frac{\tan^{-1}(x)}{x(1+x^2)} \, dx &= \int_0^1 \frac{\tan^{-1}(x)}{x(1+x^2)} \, dx + \int_1^\infty \frac{\tan^{-1}(x)}{x(1+x^2)} \, dx \\[1ex]
&= \int_0^1 \frac{\tan^{-1}(x)}{x(1+x^2)} \, dx - \int_1^0 \frac{\tan^{-1}\left(\frac1x\right)}{\frac1x\left(1+\frac1{x^2}\right)} \frac{dx}{x^2} & (1) \\[1ex]
&= \int_0^1 \frac{\tan^{-1}(x)}{x(1+x^2)} \, dx + \int_0^1 \frac{\frac\pi2 x-x\tan^{-1}(x)}{1+x^2} \, dx & (2)\\[1ex]
&= \frac\pi2 \int_0^1 \frac x{1+x^2} \, dx + \int_0^1 \frac{\tan^{-1}(x)}{1+x^2} \left(\frac1x-x\right) \, dx \\[1ex]
&= \frac{\pi\ln(2)}4 + \int_0^1 \frac{\tan^{-1}(x)}x \, dx - \int_0^1 \frac{2x\tan^{-1}(x)}{1+x^2} \, dx & (3) \\[1ex]
&= \frac{\pi\ln(2)}4 + G - \left(\frac{\pi\ln(2)}4 - \int_0^1 \frac{\ln(1+x^2)}{1+x^2} \, dx\right) & (4) \\[1ex]
&= \boxed{\frac{\pi\ln(2)}2} & (5)
\end{align*}$$

*

*$(1)$ substitute $x\mapsto\frac1x$

*$(2)$ if $x>0$, then $\tan^{-1}(x)+\tan^{-1}\left(\frac1x\right)=\frac\pi2$

*$(3)$ partial fractions

*$(4)$ $G$ is Catalan's constant; integration by parts

*$(5)$ this integral with $a=1$
