Integrating $\int_0^\infty\frac{\log (1+z^2)}{e^z-1}dz$ using residue calculus. I've been looking at how to integrate the following definite integral using the residue calculus, but can't seem to get my thoughts together. I know the $\log$ term is a multivalued function and the branch points are $i$, $-i$, and complex infinity, so I know that there must be branch cuts from $i$ and $-i$ stretching out to complex infinity (I think of this as being on a Riemann sphere with infinity at the "furthest 'pole' on the sphere."
Because of this I know that I can't use an ordinary key-hole contour because this would intersect these branch cuts. There must be any number of contours I could attempt, so my question is are there any known useful contours for dealing with such integrals? Or maybe residue calculus is no help here?
$$\int_0^\infty\frac{\log (1+z^2)}{e^z-1}dz.$$
 A: A partial answer for the moment.
I think such an integral can be attacked with complex analytic techniques, but just after some manipulations. Integrating by parts we have:
$$ I = 2\int_{0}^{+\infty}\frac{t}{1+t^2}(-\log(1-e^{-t}))\,dt =2\sum_{n=1}^{+\infty}\frac{1}{n}\int_{0}^{+\infty}\frac{te^{-nt}}{1+t^2}\,dt\tag{1}$$
and since
$$ \frac{t}{1+t^2} = \int_{0}^{+\infty}e^{-tu}\cos u \,du, \tag{2} $$
it follows that:
$$\begin{eqnarray*} I &=& 2\sum_{n=1}^{+\infty}\frac{1}{n}\int_{0}^{+\infty}\frac{\cos u}{n+u}\,du=\color{red}{2\int_{0}^{+\infty} \frac{H_u}{u} \cos u\,du}\\&=&\color{blue}{2\int_{0}^{+\infty}\frac{dv}{v+1}\sum_{n=1}^{+\infty}\frac{\cos(nv)}{n}},\tag{3}\end{eqnarray*} $$
where $H_u=\gamma+\psi(u+1)$, $\gamma$ is the Euler constant and $\psi=\frac{\Gamma'}{\Gamma}$. In this form, the integral is convergent in virtue of the integral version of the Dirichlet's test: $\color{red}{\frac{H_u}{u}}$ is a smooth function on $\mathbb{R}^+$ decreasing to zero, or $\color{blue}{\sum_{n\geq 1}\frac{\cos(nv)}{n}}$ is a $2\pi$-periodic function, $-\log(2\sin(v/2))$, belonging to $L^1((0,2\pi))$ and having mean zero. We also have:
$$\begin{eqnarray*} I &=& 2\sum_{n=1}^{+\infty}\frac{1}{n}\int_{n}^{+\infty}\frac{\cos u\cos n+\sin u\sin n}{u}\,du\\&=&2\sum_{n=1}^{+\infty}\left(-\frac{\cos n}{n}\operatorname{Ci}(n)+\frac{\sin n}{n}\left(\frac{\pi}{2}-\operatorname{Si}(n)\right)\right)\\&=&\frac{\pi(\pi-1)}{2}-2\sum_{n=1}^{+\infty}\frac{\sin n\operatorname{Si}(n)+\cos n\operatorname{Ci}(n)}{n},\tag{4}\end{eqnarray*}$$
where $\operatorname{Si}(n)=\int_{0}^{n}\frac{\sin z}{z}\,dz$ and $\operatorname{Ci}(n)=-\int_{n}^{+\infty}\frac{\cos z}{z}\,dz$.

Addendum. Binet's second $\log\Gamma$-formula can be seen as a consequence of the Abel-Plana formula and it gives
$$\log\Gamma(z)=\left(z-\frac{1}{2}\right)\log(z)-z+\log\sqrt{2\pi}+\frac{1}{\pi}\int_{0}^{+\infty}\frac{\arctan\frac{t}{2\pi z}}{e^t-1}\,dz.\tag{5}$$
If we consider such identity at $z=\frac{1}{2\pi}$, then apply $\int_{0}^{\frac{1}{2\pi}}\left(\ldots\right)\,dz$ to both sides, we recover a closed form for the similar integral $\int_{0}^{+\infty}\frac{z\log(1+z^2)}{e^z-1}\,dz$. The evaluation at $z=\frac{i}{2\pi}$ leads to a closed form for $\int_{0}^{+\infty}\frac{\text{arctanh}(z)}{e^z-1}\,dz$.
