Evaluating $\int_0^\infty \frac{\log (1+x)}{1+x^2}dx$

\begin{align*} \int_{0}^{\infty} \frac{\log (x + 1)}{x^2 + 1} \, dx &= \int_{0}^{1} \frac{\log (x + 1)}{x^2 + 1} \, dx + \int_{1}^{\infty} \frac{\log (x + 1)}{x^2 + 1} \, dx \\ &= \int_{0}^{1} \frac{\log (x + 1)}{x^2 + 1} \, dx + \int_{0}^{1} \frac{\log (x^{-1} + 1)}{x^2 + 1} \, dx \quad (x \mapsto x^{-1}) \\ &= 2 \int_{0}^{1} \frac{\log (x + 1)}{x^2 + 1} \, dx - \int_{0}^{1} \frac{\log x}{x^2 + 1} \, dx \end{align*}

For the first integral, we plug

$$ u = \frac{1-x}{1+x}, \quad dx = - \frac{2}{(u+1)^2} \, du. $$

Then it is easy to find that

$$ \int_{0}^{1} \frac{\log (x + 1)}{x^2 + 1} \, dx = \int_{0}^{1} \frac{\log 2 - \log (u + 1)}{u^2 + 1} \, du = \frac{\pi}{4}\log 2 - \int_{0}^{1} \frac{\log (u + 1)}{u^2 + 1} \, du $$

and hence

$$ \int_{0}^{1} \frac{\log (x + 1)}{x^2 + 1} \, dx = \frac{\pi}{8}\log 2. $$

For the second integral, we plug $x = e^{-t}$ and we have

\begin{align*} \int_{0}^{1} \frac{\log x}{x^2 + 1} \, dx &= - \int_{0}^{\infty} \frac{t e^{-t}}{1 + e^{-2t}} \, dt = - \sum_{n=0}^{\infty} (-1)^{n} \int_{0}^{\infty} t \, e^{-(2n+1)t} \, dt \\ &= - \sum_{n=0}^{\infty} \frac{(-1)^{n}}{(2n+1)^{2}} = - G, \end{align*}

where $G$ is the Catalan constant.

Therefore we have

$$ \int_{0}^{\infty} \frac{\log (x + 1)}{x^2 + 1} \, dx = \frac{\pi}{4} \log 2 + G. $$


If you're still interested in approaches that use contour integration, consider the function $$f(z) = \frac{\log(1+z) \log(-z)}{1+z^{2}}.$$

Using the principal branch of the logarithm, there is a branch cut along $[0,\infty)$ and a branch cut along $(-\infty, -1]$.

Then integrating counterclockwise around a keyhole contour deformed around the branch cuts (see here for a picture),

$$ \begin{align} &\int_{\infty}^{0} \frac{\log(1+x) \big(\log(x) + i \pi \big)}{1+x^{2}} \ dx + \int_{0}^{\infty} \frac{\log(1+x) \big(\log (x) - i \pi \big)}{1+x^{2}} \ dx \\ &+\int_{-\infty}^{-1} \frac{\big(\log|1+x| + i \pi \big) \log(-x)}{1+x^{2}} \ dx + \int_{-1}^{-\infty} \frac{\big(\log|1+x| - i \pi \big) \log(-x)}{1+x^{2}} \ dx \\ &= - 2 \pi i \int_{0}^{\infty} \frac{\log(1+x)}{1+x^{2}} \ dx + 2 \pi i \int_{1}^{\infty} \frac{\log(x)}{1+x^{2}} \ dx \\ &= 2 \pi i \big( \text{Res} [f(z), i] + \text{Res} [f(z), -i] \big) \\ &= 2 \pi i \left(\frac{\log(1+i) \log(-i)}{2i} + \frac{\log(1-i)\log(i)}{-2i} \right) \\ &= 2 \pi i \left( - \frac{\pi}{4} \log(2)\right) . \end{align}$$

Therefore,

$$ \begin{align} \int_{0}^{\infty} \frac{\log(1+x)}{1+x^{2}} \ dx &= \frac{\pi}{4} \log(2) + \int_{1}^{\infty} \frac{\log (x)}{1+x^{2}} \ dx \\ &= \frac{\pi}{4} \log(2) - \int_{1}^{0} \frac{\log(\frac{1}{u})}{1+ (\frac{1}{u})^{2}} \frac{1}{u^{2}} \ du \\ &= \frac{\pi}{4} \log(2) - \int^{1}_{0} \frac{\log u}{1+u^{2}} \ du \\ &= \frac{\pi}{4} \log(2) + G . \end{align}$$


$\newcommand{\+}{^{\dagger}} \newcommand{\angles}[1]{\left\langle #1 \right\rangle} \newcommand{\braces}[1]{\left\lbrace #1 \right\rbrace} \newcommand{\bracks}[1]{\left\lbrack #1 \right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil #1 \right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\equalby}[1]{{#1 \atop {= \atop \vphantom{\huge A}}}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}[1]{\left\vert #1\right\rangle} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left( #1 \right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ According to user $\tt@Cody$ answer , the important integral to evaluate is $\ds{\int_{0}^{1}{\ln\pars{x + 1} \over x^{2} + 1}\,\dd x}$.

Hereafter we'll show a $\quad\color{#888}{\large\ds{\tt\ul{\mbox{simple and quite short}}}}\quad$ evaluation.

With $\ds{x \equiv \tan\pars{\theta}}$: \begin{align} \color{#00f}{\large\int_{0}^{1}{\ln\pars{x + 1} \over x^{2} + 1}\,\dd x}&= \int_{0}^{\pi/4}\ln\pars{\tan\pars{\theta} + 1}\,\dd\theta \\[3mm]&=\half\,\bracks{\int_{0}^{\pi/4}\ln\pars{\tan\pars{\theta} + 1}\,\dd\theta + \int_{0}^{\pi/4}\ln\pars{\tan\pars{{\pi \over 4} - \theta} + 1}\,\dd\theta} \\[3mm]&=\half\,\bracks{\int_{0}^{\pi/4}\ln\pars{\tan\pars{\theta} + 1}\,\dd\theta + \int_{0}^{\pi/4} \ln\pars{{1 - \tan\pars{\theta} \over 1 + \tan\pars{\theta}} + 1}\,\dd\theta} \\[3mm]&=\half\,\bracks{\int_{0}^{\pi/4}\ln\pars{\tan\pars{\theta} + 1}\,\dd\theta + \int_{0}^{\pi/4}\ln\pars{2 \over 1 + \tan\pars{\theta}}\,\dd\theta} \\[3mm]&=\half\int_{0}^{\pi/4}\ln\pars{2}\,\dd\theta =\color{#00f}{\large{1 \over 8}\,\pi\ln\pars{2}} \end{align}