Evaluating $\int_0^{\infty}\frac{\ln(x^2+1)}{x^2+1}dx$ How would I go about evaluating this integral?
$$\int_0^{\infty}\frac{\ln(x^2+1)}{x^2+1}dx.$$
What I've tried so far: I tried a semicircular integral in the positive imaginary part of the complex plane, excluding the negative real axis, but had trouble calculating the residue at $z=i$ (perhaps there is a way of doing this that I don't know of). After that didn't work, I tried a rectangular box integral from $\epsilon$ to $R$, from $R$ to $R+i/2$, from $R+i/2$ to $-S+i/2$, from $-S+i/2$ to $-S+i\epsilon$, from $-S+i\epsilon$ to $-\epsilon+i\epsilon$ and finally a semicircle around the origin, radius $\epsilon$. 
Any help would be appreciated.

Here is a way by using contour integration and easy to understand:
Convention:
The branch of the logarithm is principal branch cut.
The argument is using under principal value.
$$\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}
$$
Doing contour integration with respect to function: $f(x) = log(x+i)/(x^2+1)$
Define contour:
$\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$
Easy to see: $\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$
So $\int_{\Gamma_2} f(x)  = 0$
The residue for $f(x)$ at $x = i$ is $\frac{\log(2)+ \frac{\pi}{2}}{2i}$
By residue theorem: $\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} \\$$
Recall: $\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)  
$$
Substitute into $(1)$,$\int_{0}^{\infty} \frac{\log(|x+i|) + log(|x-i|)}{1+x^2}~dx = \pi \log(2)$
