$$f(z)=\frac{\log z}{(1+z^2)^2} = \frac{\log z}{(z+i)^2(z-i)^2}$$
where we use the principal branch of the logarithm.
$$P.V.\int_{-R}^R f(z)\, dz = \int_{\epsilon}^R f(z)\, dz+\int_{-R}^\epsilon f(z)\, dz = \int_{\epsilon}^R f(z)\, dz + \int_{\epsilon}^R\frac{\log z+i\pi}{(1+z^2)^2}\, dz =$$
$$= 2\int_{\epsilon}^R f(z)\, dz + i\pi\int_{\epsilon}^R \frac{dz}{(1+z^2)^2}$$
Then, considering the contour $\Gamma$ that traverses $-R$ to $R$ (indented at $z=0$ around $\epsilon e^{i \theta}$) and then travels back along $Re^{i \theta}$, there is only one pole of $f(z)$ in $\Gamma$. As $R \to \infty$, the integral around the arc disappears, so
$$2\pi i \operatorname*{Res}_{z = i} f(z) = 2\int_{\epsilon}^\infty f(z)\, dz + \int_{0}^\pi f(\epsilon e^{i \theta})i\epsilon e^{i \theta}\, d\theta + i\pi\int_{\epsilon}^\infty \frac{dz}{(1+z^2)^2}$$
and as $\epsilon \to 0$, we see the RHS becomes
$$2\int_{0}^\infty f(z)\, dz + \frac{i \pi^2}{4}$$
The poles are of order 2, thus
$$\operatorname*{Res}_{z = i} f(z) = \lim_{z \to i}\,\frac{d}{dz}(z-i)^2f(z) = \frac{\pi+2 i}{8}$$
Thus
$$-\frac{\pi}{2}+ \frac{i \pi^2}{4} = 2\int_{0}^\infty f(z)\, dz + \frac{i \pi^2}{4}$$
and we finally find
$$\int_{0}^\infty \frac{\log z}{(1+z^2)^2}\, dz = -\frac{\pi}{4}$$
$\blacksquare$