Prove that $2\int_0^\infty \frac{e^x-x-1}{x(e^{2x}-1)} \, \mathrm{d}x =\ln(\pi)-\gamma $

Hint. One may set $$ f(s):=2\int_0^\infty \frac{e^{sx}-sx-1}{x(e^{2x}-1)}dx, \quad 0<s<2. \tag1 $$ In order to get rid of the factor $x$ in the denominator, we may differentiate under the integral sign getting $$ f'(s)=2\int_0^\infty \frac{e^{sx}-1}{e^{2x}-1}dx, \quad 0<s<2. \tag2 $$ Then expanding the latter integrand in $e^{-kx}$ terms and integrating termwise we get $$ f'(s)=-\gamma-\psi\left(1-\frac{s}2\right) \tag3 $$ where $\displaystyle \psi : = \Gamma'/\Gamma$ and where $\gamma$ is the Euler-Mascheroni constant.

Integrating $(3)$, with the fact that, as $s \to 0$, $f(s) \to 0$, we get

$$ 2\int_0^\infty \frac{e^{sx}-sx-1}{x(e^{2x}-1)}dx=-\gamma s+2 \log \Gamma\left(1-\frac{s}2\right), \quad 0<s<2, \tag4 $$

from which you deduce the value of your initial integral by putting $s:=1$.

Identity $(4)$ is much more than what was asked.


By Frullani's theorem we have: $$ \int_{0}^{+\infty}\frac{e^x-1-x}{x}\,e^{-2m x}\,dx = -\frac{1}{2m}+\log\left(\frac{2m}{2m-1}\right)\tag{1}$$ hence it is straightforward to prove the claim by summing $(1)$ over $m\geq 1$, then exploiting: $$ \gamma = \sum_{n\geq 1}\left[\frac{1}{n}-\log\left(1+\frac{1}{n}\right)\right] \tag{2}$$ that is just the usual definition of the Euler-Mascheroni constant, together with: $$ \sum_{n\geq 1}(-1)^n \log\left(1+\frac{1}{n}\right) = -\log\left(\frac{2}{1}\cdot\frac{2}{3}\cdot\frac{4}{3}\cdot\frac{4}{5}\cdot\ldots\right) = -\log\frac{\pi}{2} \tag{3}$$ that follows from Wallis' product.


$$ \begin{align} 2\int_{0}^{\infty} \frac{e^x-x-1}{x(e^{2x}-1)} \, dx &= 2 \int_{0}^{\infty} \frac{1}{x(e^{2x}-1)} \sum_{n=2}^{\infty} \frac{x^{n}}{n!}\\ & = 2 \sum_{n=2}^{\infty}\frac{1}{n!} \int_{0}^{\infty} \frac{x^{n-1}}{e^{2x}-1} \, dx \\ &= 2 \sum_{n=2}^{\infty}\frac{1}{n!2^{n}} \int_{0}^{\infty} \frac{u^{n-1}}{e^{u}-1} \, du \\ &= 2 \sum_{n=2}^{\infty} \frac{\zeta(n)}{n 2^{n}} \tag{1} \\ &= 2 \sum_{n=2}^{\infty} \frac{1}{n 2^{n}} \sum_{k=1}^{\infty} \frac{1}{k^{n}} \\ &= 2 \sum_{k=1}^{\infty} \sum_{n=2}^{\infty} \frac{1}{n(2k)^{n}} \\ & =2 \sum_{k=1}^{\infty} \left[ \log \left(\frac{2k}{2k-1} \right) - \frac{1}{2k}\right] \\ & =2 \lim_{N \to \infty} \left(\log \left(\frac{(2N)!!}{(2N-1)!!} \right) - \frac{H_{N}}{2} \right) \\ &= 2 \lim_{N \to \infty} \left(\log \left(\frac{2^{2N}(N!)^2}{(2N)!} \right) - \frac{H_{N}}{2} \right) \tag{2} \\ &= 2 \lim_{N \to \infty} \left(\log \left(\frac{2^{2N}(2\pi N) \left(\frac{N}{e} \right)^{2N}}{\sqrt{2 \pi(2N)} \left(\frac{2N}{e} \right)^{2N}} \right) - \frac{H_{N}}{2} \right) \tag{3} \\ &= \lim_{N \to \infty} \left(\log(\pi) + \log(N) - H_{N} \right) \\ &= \log(\pi) - \gamma \end{align}$$


$(1)$ https://en.wikipedia.org/wiki/Riemann_zeta_function#Definition

$(2)$ http://mathworld.wolfram.com/DoubleFactorial.html

$(3)$ https://en.wikipedia.org/wiki/Stirling's_approximation