Calculate $\int _0^\infty \frac{\ln x}{(x^2+1)^2}dx$ Calculate $$\int _0^\infty \dfrac{\ln x}{(x^2+1)^2}dx.$$
I am having trouble using Jordan's lemma for this kind of integral. Moreover, can I multiply it by half and evaluate $\frac{1}{2}\int_0^\infty \frac{\ln x}{(x^2+1)^2}dx$?
 A: Here is how to do it using complex analysis.
First of all in this case you can't compute $\frac{1}{2}\int_{-\infty}^\infty \frac{\ln x}{(x^2+1)^2}$ since it does not equal your integral (why?).
Now take $R>1$, $r<1$ and $\gamma$ a "keyhole" contour as shown below 

Lets take the branch cut of the logarithm with domain $\mathbb{C} \setminus \{iy: y \leq 0\}$, in which one $\ln(x) \in \mathbb{R}$ if $x \in \mathbb{R}^+$. 
Now, on one side the Residue theorem tells us that if $f(z)=\frac{\ln(z)}{(z^2+1)^2} $
$$
\int_\gamma f(z)dz = 2\pi i \cdot \text{Res}(f(z), i) = 2\pi i \left( \lim_{z\to i} \frac{d}{dz}\left[ (z-i)^2 \frac{\ln(z)}{(z+1)^2(z-i)^2}\right]\right) = -\frac{\pi}{2}+ i \frac{\pi^2}{4}
$$
On the other side is easily seen that the integral over the half semicircle connecting $R$ with $-R$ (lets call it $I_{C_1}$) goes to zero as $R$ goes to infinity, since 
$$
|I_{C_1}|=\left|\int_0^\pi \frac{\ln(Re^{it})iRe^{it}}{(R^2e^{2it}+1)^2}dt\right| \underset{R \to \infty}{\longrightarrow} 0
$$
And that the one over semicircle connecting $-r$ with $r$ (this one will be called $I_{C_2}$) goes to zero as $r$ goes to $0$ because
$$
|I_{C_2}|=\left|\int_\pi^0 \frac{\ln(re^{it})ire^{it}}{(r^2e^{2it}+1)^2}dt\right| \underset{r \to 0}{\longrightarrow} 0
$$
Hence
\begin{align}
\int_\gamma f(z)dz & = \int_r^R \frac{\ln(x)}{(x^2+1)^2}dx + \int_{-R}^{-r} \frac{\ln(x)}{(x^2+1)^2}dx + I_{C_1} + I_{C_2} \\
 & = \int_r^R \frac{\ln(x)}{(x^2+1)^2}dx - \int_{R}^{r} \frac{\ln(-y)}{(y^2+1)^2}dy + I_{C_1} + I_{C_2}\\
 & = \int_r^R \frac{\ln(x)}{(x^2+1)^2}dx + \int_{r}^{R} \frac{\ln(-y)}{(y^2+1)^2}dy + I_{C_1} + I_{C_2}\\
 & = \int_r^R \frac{\ln(x)}{(x^2+1)^2}dx + \int_{r}^{R} \frac{\ln|y| + i \pi}{(y^2+1)^2}dy + I_{C_1} + I_{C_2}\\
& = 2\int_r^R \frac{\ln(x)}{(x^2+1)^2}dx + i \pi \underbrace{\int_{r}^{R} \frac{dy}{(y^2+1)^2} }_{J}+ I_{C_1} + I_{C_2}\\
\end{align}
However, as an indefinite integral $J$ can be compute by trigonometric substitution, as follows, let $y=\tan(u)$ then
$$
\int \frac{dy}{(y^2+1)^2} = \int \cos^2(u) du  = \frac{1}{4}\sin(2u)+\frac{1}{2}u = \frac{1}{4}\sin(2\tan^{-1}(y))+\frac{1}{2}\tan^{-1}(y)
$$
Hence we have 
$$
\lim_{R\to \infty}\lim_{r\to 0}J=\int_0^\infty \frac{dy}{(y^2+1)^2} = \frac{1}{4}\sin(\pi)+\frac{\pi}{4} - \left( \frac{1}{4}\sin(0)+0\right) = \frac{\pi}{4}
$$
Therefore, finally we conclude that 
\begin{align}
 -\frac{\pi}{2}+ i \frac{\pi^2}{4} & = \lim_{R\to \infty}\lim_{r\to 0} \left( \int_\gamma f(z)dz \right) \\
& =  \lim_{R\to \infty}\lim_{r\to 0} \left(  2\int_r^R \frac{\ln(x)}{(x^2+1)^2}dx + i \pi \int_{r}^{R} \frac{dy}{(y^2+1)^2}+ I_{C_1} + I_{C_2}\right) \\ 
& = 2 \int_0^\infty \frac{\ln(x)}{(x^2+1)^2}dx + i \pi \left(\frac{\pi}{4}\right) + 0 + 0 
\end{align}

Thus 
  $$
\int_0^\infty \frac{\ln(x)}{(x^2+1)^2}dx = \frac{1}{2}\left(  -\frac{\pi}{2}+ i \frac{\pi^2}{4} -i \frac{\pi^2}{4}  \right) = -\frac{\pi}{4}
$$ 

A: A faster complex analysis computation: rewrite the integral as the real part of a contour integral
$$I=\frac12\Re \int_C\frac{\ln z\,dz}{\left(z^2+1\right)^2},$$
where $C$ goes from $-\infty$ to $\infty$ slightly above the negative part of the real axis ($\Re$ kills the imaginary part of the logarithm). But now all we have to do is to pull $C$ to $i\infty$ so that
$$I=\frac12\Re\left(2\pi i \operatorname{res}_{z=i}\frac{\ln z}{\left(z^2+1\right)^2}\right)=-\frac{\pi}{4}.$$
A: Let's look at the complex function 
$$
f(z)=\frac{\log^2(z)}{(z^2+1)^2}
$$
First observe that (putting the branch cut along the positive real axis) for $x>0$
$$
f(x+i \delta)=\frac{\log^2(x)}{(x^2+1)^2}\\
f(x-i \delta)=\frac{\log^2(x)+4\pi i \log(x)-4\pi^2}{(x^2+1)^2}\quad (*)\\
$$
with $\delta\rightarrow0_+$ 
You may integrate $f(z)$ around a keyhole contour with slit along the positive real axis. It holds by residue theorem, that 
$$
\oint f(z)dz=\int_0^{\infty}f(x+i \delta)dx+\int_{\infty}^0f(x-i \delta)dx+\\\lim_{r\rightarrow0}r\int_{\psi\in[3\pi/2,\pi/2]}e^{i\psi}f(r e^{i\psi})d\psi+\lim_{R\rightarrow\infty}R\int_{\phi\in(0,2\pi]}e^{i\phi}f(Re^{i\phi})d\phi\\=2\pi i\sum_i\text{res}(f(z),z=z_i)
$$
It is easily shown that the last two contributions, which are the small semic circle around the origin and the big circle which closes the contour, vanish. Furthermore we know that the residues are located at $z_i=\pm i$.
So using (*) we can conclude that (the sum of residues is straightforwardly calculated by $\text{res}(f(z),z_0)=\lim_{z\rightarrow z_0 }\partial_z[(z-z_0) f(z)]$ if one has in mind that $\log(i)=\pi/2$ and $\log(-i)=\frac{3\pi i}{2}$ for our choice of branches) 
$$
-4\pi i\int_0^{\infty}\frac{ \log(x)}{(x^2+1)^2}+4\pi^2\underbrace{\int_0^{\infty}\frac{1}{(x^2+1)^2}}_{J}=\pi^3+i\pi^2
$$ 
where $J$ can be calculated through
$$
J=-\partial_a\int_0^{\infty}\frac{1}{x^2+a}\big|_{a=1}=-\partial_a\frac{\pi }{2 \sqrt{a}}\big|_{a=1}=\frac{\pi}{4}
$$
Now we are ready to state our final result:
$$
\int_0^{\infty}\frac{\log(x)}{(x^2+1)^2}=\frac{1}{-4\pi i }\left(i \pi^2-4\pi^2 \frac{\pi}{4}+\pi^3\right)=-\frac{\pi}{4}
$$
in agreement with @Olivier Oloa's answer
A: \begin{align}
I&=\int _0^\infty \dfrac{\ln x}{(x^2+1)^2}dx\\
&=\int _0^1 \dfrac{\ln x}{(x^2+1)^2}dx+\int _1^\infty \dfrac{\ln x}{(x^2+1)^2}dx\\
&=\int _0^1 \dfrac{\ln x}{(x^2+1)^2}dx-\int _0^1 \dfrac{x^2\ln x}{(x^2+1)^2}dx\\
&=\int _0^1 \dfrac{(1-x^2)\ln x}{(x^2+1)^2}dx\\
&=\int _0^1 \sum_{j=0}^{\infty}(-1)^j (2 j+1) x^{2 j}\ln xdx\\
&=\sum_{j=0}^{\infty}(-1)^j (2 j+1)\int _0^1  x^{2 j}\ln xdx\\
&=-\sum_{j=0}^{\infty}(-1)^j \frac{2 j+1}{(2j+1)^2}\\
&=-\sum_{j=0}^{\infty}(-1)^j \frac{1}{2j+1}\\
&=-\frac{\pi}{4}
\end{align}
where at last you may recall the expansion for $\arctan$.
A: Here is a 'real-analysis route'.
Step 1. We have $$ \int_0^{+\infty}\frac{\ln x}{x^2+1} dx=0 \tag1$$ as may be seen by writing
$$
\begin{align}
 \int_0^{+\infty}\frac{\ln x}{x^2+1} dx&=\int_0^1\frac{\ln x}{x^2+1} dx+\int_1^{+\infty}\frac{\ln x}{x^2+1} dx\\\\
&=\int_0^1\frac{\ln x}{x^2+1} dx-\int_0^1\frac{\ln x}{\frac{1}{x^2}+1} \frac{dx}{x^2}\\\\
&=0.
\end{align}
$$
Step 2. Assume $a>0$. We have $$ \int_0^{+\infty}\frac{\ln x}{x^2+a^2} dx=\frac{\pi}{2}\frac{\ln a}{a} \tag2$$ 
as may be seen by writing
$$
\begin{align}
 \int_0^{+\infty}\frac{\ln x}{x^2+a^2} dx&= \int_0^{+\infty}\frac{\ln (a \:u)}{(a \:u)^2+a^2} (a \:du)\\\\
&=\frac1a\int_0^{+\infty}\frac{\ln a +\ln u}{u^2+1} du\\\\
&=\frac{\ln a}{a}\int_0^{+\infty}\frac{1}{u^2+1} du+\frac1{a}\int_0^{+\infty}\frac{\ln u}{u^2+1} du\\\\
&=\frac{\ln a}{a}\times \frac{\pi}2+\frac1{a}\times 0\\\\
&=\frac{\pi}{2}\frac{\ln a}{a}.
\end{align}
$$
Step 3. Assume $a>0$. We have $$ \int_0^{+\infty}\frac{\ln x}{(x^2+a^2)^2} dx=\frac{\pi}{4}\frac{\ln a-1}{a^3} \tag3$$ 
since sufficient conditions are fulfilled to differentiate both sides of $(2)$.
Putting $a:=1$ in $(3)$ gives

$$ \int_0^{+\infty}\frac{\ln x}{(x^2+1)^2} dx=\color{blue}{-\frac{\pi}{4}}.
$$

