<s>[INST] 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$?
 [/INST] 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}
$$ 

</s>