Esta es una manera de utilizar la integración de contornos y fácil de entender:
Convención:
La rama del logaritmo es el corte de la rama principal.
El argumento es utilizar bajo valor principal.
$$\int_{0}^{\infty} \frac{\log(1+x^2)}{1+x^2}~dx = \\ \int_{0}^{\infty} \frac{\log(x^2+1)}{1+x^2}~dx = \\ \int_{0}^{\infty} \frac{\log((x+i)(x-i))}{1+x^2}~dx = \\\int_{0}^{\infty} \frac{\log(|x+i|) + Arg(x+i) + log(|x-i|)+ Arg(x-i) }{1+x^2}~dx = \\ \int_{0}^{\infty} \frac{\log(|x+i|) + log(|x-i|)+ Arg(2x) }{1+x^2}~dx = \\$$$$ \int_{0}^{infty} \frac{log(|x+i|) + log(|x-i|)}{1+x^2}~dx \tag{1} $$
Hacer la integración del contorno con respecto a la función: $f(x) = log(x+i)/(x^2+1)$
Definir el contorno:
$\Gamma_1:= x \text{ from } 0 \text{ to } \infty$
$\Gamma_2:= x \text{ from } \infty \text{ to } -\infty \text{ along the upper semicircle}$
$\Gamma_3:= x \text{ from } -\infty \text{ to } 0$
Fácil de ver: $\int_{\Gamma_2} |f(x)| \leq 2 \pi \max_{\Gamma_2} {\frac{|\log(x+i)|}{|1+x^2|}} \leq \frac{log(\sqrt{x^2+1})}{x^2+1}+\frac{\pi^2}{x^2+1} = 0$
Así que $\int_{\Gamma_2} f(x) = 0$
El residuo para $f(x)$ en $x = i$ es $\frac{\log(2)+ \frac{\pi}{2}}{2i}$
Por el teorema del residuo: $\int_{\Gamma_1} f(x) + \int_{\Gamma_3} f(x) = 2\pi Res(f,i) = \pi \log(2) + \frac{\pi^2 i}{2} $
$$\int_0^\infty \frac{log(x+i)}{(x^2+1)} + \int_{-\infty}^0 \frac{log(x+i)}{(x^2+1)} = \pi \log(2) + \frac{\pi^2 i}{2} \implies\\\int_0^\infty \frac{log|x+i|}{(x^2+1)} + \int_{-\infty}^0 \frac{log(|x+i|)+ \pi i}{(x^2+1)} = \pi \log(2) + \frac{\pi^2 i}{2} \implies\\\int_0^\infty \frac{log|x+i|}{(x^2+1)} + \int_{-\infty}^0 \frac{log(|x+i|)}{(x^2+1)}+ \int_{-\infty}^0 \frac{ \pi i}{(x^2+1)} = \pi \log(2) + \frac{\pi^2 i}{2} \\$$
Recuerdo: $\int \frac{1}{x^2+1} = arctan(x)+c$
$$ \implies \int_0^\infty \frac{log|x+i|}{(x^2+1)} + \int_{0}^{\infty} \frac{log(|x-i|)}{(x^2+1)}+ \frac{i\pi^2}{2} = \pi \log(2) + \frac{i\pi^2}{2}\\\\\implies \int_0^\infty \frac{log|x+i| + log|x-i|}{(x^2+1)} = \pi \log(2) $$
Sustituir en $(1)$ , $\int_{0}^{\infty} \frac{\log(|x+i|) + log(|x-i|)}{1+x^2}~dx = \pi \log(2)$