Evaluating $\int_0^{\infty}\frac{\ln(x^2+1)}{x^2+1}dx$
Use $x\to \tan\theta$ and $dx=\sec^2\theta\ d\theta$. The integral becomes $$\int_0^{\pi/2} 2\ln (\sec \theta) d\theta$$
Which is $$-2\int_0^{\pi/2} \ln (\cos\theta) d\theta$$ And can be solved.
Let $$I= \displaystyle \int_0^{\pi/2} \ln \left( \sin \theta \right) \cdot d\theta$$ $$I= \displaystyle \int_0^{\pi/2} \ln \left( \cos \theta \right) \cdot d\theta$$ Adding both. $$2I=\displaystyle \int_0^{\pi/2} \ln \left( \sin \theta \times \cos \theta\right) \cdot d\theta$$ $$2I= \displaystyle \int_0^{\pi/2} \ln \left(2 \sin \theta\times \cos \theta \right) -\ln2 \cdot d\theta$$ $$2I=\int_0^{\pi/2}\ln(\sin{2\theta})-\ln2 \cdot d\theta$$ $$\int_0^{\pi/2}\ln(\sin{2\theta})\cdot d\theta=I$$ So, $$I=-\int_0^{\pi/2}\ln2\cdot d\theta$$ $$I=-\dfrac{\pi\ln2}2$$
And your integral comes out to be
$${\pi \ln2}$$
Maybe this is going to seem a lot more involved than it needs to be, but it is likely that complex methods are not the best way to attack an integral like this. Nonetheless, it is possible.
We consider the integral in the complex plane
$$\oint_C dz \frac{\log{(1+z^2)}}{1+z^2}$$
where $C$ is some contour to be determined. Our first instinct is to make $C$ a simple semicircle in the upper half plane. The problem is that the branch point singularity at $z=i$ is extremely problematic, as it coincides with an ostensible pole. Nonetheless, the corresponding integral over the real line is finite (and twice the originally specified integral), so there must be a way to treat this.
The way to go with branch points like this is to avoid them. We thus have to draw $C$ so as to do that, and then use Cauchy's theorem to state that the above complex integral about $C$ is zero. Such a contour $C$ is illustrated below.
The contour integral is then taken along six different segments. I will state without proof that the integral about the two outer arcs vanishes as the radius of those arcs $R \to \infty$. We are then left with four integrals:
$$\int_{-R}^R dx \frac{\log{(1+x^2)}}{1+x^2} + \left [\int_{C_-}+\int_{C_+}+\int_{C_{\epsilon}} \right ] dz \frac{\log{(1+z^2)}}{1+z^2} = 0$$
$C_-$ is the segment to the right of the imaginary axis, down from the arc to the branch point, $C_+$ is the segment to the left of the imaginary axis, up from the branch point to the arc, and $C_{\epsilon}$ is the circle about the branch point of radius $\epsilon$.
It is crucial that we get the arguments of the log correct along each path. I note that the segment $C_-$ is "below" the imaginary axis and I assign the phase of this segment to be $2 \pi$, while I assign the phase of the segment $C_+$ to be $0$.
For the segment $C_-$, set $z=i(1+y e^{i 2 \pi})$:
$$\int_{C_-} dz \frac{\log{(1+z^2)}}{1+z^2} = i\int_R^{\epsilon} dy \frac{\log{[-y (2+y)]}+ i 2 \pi}{-y (2+y)} $$
For the segment $C_+$, set $z=i(1+y)$:
$$\int_{C_-} dz \frac{\log{(1+z^2)}}{1+z^2} = i\int_{\epsilon}^R dy \frac{\log{[-y (2+y)]}}{-y (2+y)} $$
I note that the sum of the integrals along $C_-$ and $C_+$ is
$$-2 \pi \int_{\epsilon}^R \frac{dy}{y (2+y)} = -\pi \left [ \log{R} - \log{(2 + R)} - \log{\epsilon} + \log{(2 + \epsilon)}\right]$$
For the segment $C_{\epsilon}$, set $z=i (1+\epsilon e^{-i \phi})$. The integral along this segment is
$$\begin{align}\int_{C_{\epsilon}} dz \frac{\log{(1+z^2)}}{1+z^2} &= \epsilon \int_{-2 \pi}^0 d\phi e^{-i \phi} \frac{\log{\left [ -2 \epsilon e^{-i \phi} \right]}}{-2 \epsilon e^{-i \phi}}\end{align}$$
Here we use $\log{(-1)}=-i \pi$ and the above integral becomes
$$\begin{align}\int_{C_{\epsilon}} dz \frac{\log{(1+z^2)}}{1+z^2} &= -\frac12 (-i \pi)(2 \pi) - \frac12 \log{2} (2 \pi) - \frac12 \log{\epsilon} (2 \pi) -\frac12 (-i) \frac12 (0-4 \pi^2) \\ &= -\pi \log{2} - \pi \log{\epsilon} \end{align}$$
Adding the above integrals, we have
$$\begin{align}\int_{-R}^R dx \frac{\log{(1+x^2)}}{1+x^2} -\pi \log{R} + \pi \log{(2 + R)} + \pi \log{\epsilon} - \pi \log{(2 + \epsilon)} -\pi \log{2} - \pi \log{\epsilon} &= 0\\ \implies \int_{-R}^R dx \frac{\log{(1+x^2)}}{1+x^2} -\pi \log{R} + \pi \log{(2 + R)} - \pi \log{(2 + \epsilon)} -\pi \log{2} &=0\end{align}$$
Now we take the limit as $R \to \infty$ and $\epsilon \to 0$ and we get
$$\int_{-\infty}^{\infty} dx \frac{\log{(1+x^2)}}{1+x^2} -2 \pi \log{2} = 0$$
Therefore
$$\int_{0}^{\infty} dx \frac{\log{(1+x^2)}}{1+x^2} = \pi \log{2}$$
One way to solve this problem is to use parametric integrals. Let $$ I(\alpha)=\int_{0}^{\infty}\frac{\ln(\alpha x^2+1)}{x^2+1}dx. $$ Then \begin{eqnarray*} I'(\alpha)&=&\int_{0}^{\infty}\frac{x^2}{(\alpha x^2+1)(x^2+1)}dx\\ &=&\int_{0}^{\infty}\left(-\frac{1}{\alpha-1}\frac{1}{\alpha x^2+1}+\frac{1}{\alpha-1}\frac{1}{x^2+1}\right)dx\\ &=&-\frac{1}{\alpha-1}\frac{1}{\sqrt{\alpha}}\frac{\pi}{2}+\frac{1}{\alpha-1}\frac{\pi}{2}\\ &=&\frac{\pi}{2}\frac{\sqrt{\alpha}-1}{\sqrt{\alpha}(\alpha-1)}\\ &=&\frac{\pi}{2}\left(\frac{1}{\sqrt{\alpha}}-\frac{1}{\sqrt{\alpha}+1}\right). \end{eqnarray*} Thus $$ I(\alpha)=\pi\ln(\sqrt{\alpha}+1)+C. $$ But $I(0)=0$ implies $C=0$. So $I(1)=\pi\ln 2$.