Residue Theorem Integral of $\frac{1}{\sinh(x)-1}$ I need help with the integral: $$\int_{-\infty}^\infty\frac{x}{\sinh(x)-1}dx,$$ and I (unfortunately) have to use contour integration techniques. I know how to do the integral $$\int_{-\infty}^\infty\frac{1}{\sinh(x)}dx,$$ so using a similar strategy, I tried integrating $$f(z):=\frac{z}{\sinh(z)-1}$$ around a box of width $2R$ and height $\pi $ centered at the origin. However, $\frac{1}{\sinh(x)-1}$ has poles at $z_n=\ln(2\pm\sqrt{2})+2\pi i n,$ for $n\in\mathbb{N}$, and so we must make $\epsilon$ bumps around $\log(2\pm\sqrt{2})$. However, around these bumps,
$$\int_{C_\epsilon}f(z)dz=\int_0^\pi\frac{2\log(1\pm\sqrt{2})+2\epsilon e^{-i\theta}}{\log(1\pm \sqrt{2})[e^{\epsilon e^{i\theta}}-e^{-\epsilon e^{-\theta}}]-1}\cdot -i\epsilon e^{-i\theta}d\theta$$
Does this simplify? I'm not sure how to tackle this. I also thought about making a substitution $x\mapsto \ln(x)$ at the very beginning, but the integration bounds that I get confuse me (I get from $-\infty +i\pi$ to $\infty$).
 A: DETERMINING CONVERGENCE
We are asked to evaluate the integral $I$ given by
$$I=\int_{-\infty}^\infty \frac{x}{\sinh(x)-1}\,dx\tag1$$
We denote the denominator of the integrand in $(1)$ by $g(x)=\sinh(x)-1$.  For $x\in \mathbb{R}$, it is easy to show that $g(x)$ has a single root $x_0-=\log(1+\sqrt 2)$.
Then, from the prosthaphaeresis identity
$$\begin{align}
g(x)&=\sinh(x)-1\\\\
&=\sinh(x)-\sinh(x_0)\\\\
&=2\cosh\left(\frac{x+x_0}{2}\right)\sinh\left(\frac{x-x_0}{2}\right)
\end{align}$$
we find that $g(x)=O\left(x-x_0\right)$ as $x\to x_0$.

Hence, we conclude that the integral in $(1)$ fails to exist.


CAUCHY-PRINCIPAL VALUE
However, the Cauchy Principal Value of $(1)$ does exist and is expressed as
$$\begin{align}\text{PV}\left(\int_{-\infty}^\infty \frac{x}{\sinh(x)-1}\,dx\right)&=\lim_{\varepsilon\to 0^+}\left(\int_{-\infty}^{x_0-\varepsilon} \frac{x}{\sinh(x)-1}\,dx\\+\int_{x_0+\varepsilon}^\infty \frac{x}{\sinh(x)-1}\,dx\right)\tag2
\end{align}$$
In the next section, we use contour integration to evaluate $(2)$.


EVALUATION OF THE CAUCHY PRINCIPAL VALUE
Let $f(z)=\frac{z^2}{\sinh(z)-1}$, $z\in \mathbb{C}$.  The poles of $f(z)$ are simple and located at $z_n=x_0+i2n\pi$ and $z'_n=-x_0+i(2n+1)\pi$.
Let $J$ be the integral
$$J=\oint_C f(z)\,dz$$
where $C$ is the contour comprised of the six line segments $(i)$ from $-R$ to $z_0-\varepsilon$, $(ii)$ from $z_0+\varepsilon$ to $R$, $(iii)$ from $R$ to $R+i2\pi$, $(iv)$ from $R+in\pi$ to $z_1+\varepsilon$, $(v)$ from $z_1-\varepsilon$ to $-R+i2\pi$, and $(vi)$ from $-R+i2\pi$ to $-R$ and the two semicircular arcs $(i)$ $z_0+\varepsilon e^{i\phi}$, from $\phi=\pi$ to $\phi=0$ and (ii) $z_1+\varepsilon e^{i\phi}$, from $\phi=2\pi$ to $\phi=\pi$.

APPLYING THE RESIDUE THEOREM
The contour $C$ encloses only the simple pole at $z'_0=-x_0+i\pi$.  Therefore, the reside theorem guarantees that for $R>|z_0'|$
$$\begin{align}
\oint_C f(z)\,dz&=2\pi i \text{Res}\left(f(z), z=z'_0\right)\\\\
&=2\pi i \lim_{z\to z'_0}\left(\frac{z^2(z-z'_0)}{\sinh(z)-1}\right)\\\\
&=2\pi i \lim_{z\to z'_0}\frac{z^2}{\cosh(z)}\\\\
&=2\pi i \frac{(z'_0)^2}{\cosh(z'_0)}\\\\
&=2\pi i \frac{(x_0+i\pi)^2}{-\sqrt 2}\\\\
&=-\frac{i\pi}{\sqrt 2}(2(x_0+i\pi)^2)\tag3
\end{align}$$

EXPRESSING THE INTEGRAL OVER $C$
We also have as $R\to \infty$ and $\varepsilon \to 0^+$
$$\begin{align}
\lim_{R\to\infty\\\varepsilon\to 0^+}\oint_C f(z)\,dz&= \text{PV}\left(\int_{-\infty}^{\infty}\frac{x^2}{\sinh(x)-1}\,dx\right)-\text{PV}\left(\int_{-\infty}^{\infty}\frac{(x+i2\pi)^2}{\sinh(x)-1}\,dx\right)\\\\
&-i\pi \frac{z_0^2}{\cosh(z_0)}-i\pi\frac{z_1^2}{\cosh(z_1)}\\\\
&=-i4\pi \text{PV}\left(\int_{-\infty}^{\infty}\frac{x}{\sinh(x)-1}\,dx\right)\\\\
&+4\pi^2\text{PV}\left(\int_{-\infty}^{\infty}\frac{1}{\sinh(x)-1}\,dx\right)\\\\
&-\frac{i\pi }{\sqrt 2}(z_0^2+(z_0+i2\pi)^2)\tag4
\end{align}$$

CONCLUSION
Equating $(3)$ and $(4)$ we find that
$$\bbox[5px,border:2px solid #C0A000]{\text{PV}\left(\int_{-\infty}^\infty \frac{x}{\sinh(x)-1}\,dx\right)=\frac{\pi^2}{2\sqrt 2}}$$
A: I think rewriting the problem with an appropriate substitution will turn it into a much more standard application of the residue theorem. Rewriting the integral using the definition of $\sinh(x)$, we have that
$$\int_{-\infty}^{\infty} \frac{x}{\sinh(x) - 1}dx = \int_{-\infty}^{\infty} \frac{x}{\frac{1}{2}(e^x - e^{-x}) - 1}dx.$$
Making the substitution $u = e^x$, we then have the relationships $\ln(u) = x$ and $du = e^xdx = u dx$. Our domain's bounds also change under this substitution, so our integral becomes
$$\int_{-\infty}^{\infty} \frac{x}{\frac{1}{2}(e^x - e^{-x}) - 1}dx = \int_0^{\infty} \frac{\ln(u)}{\frac{1}{2}(u-u^{-1})-1}\frac{du}{u} = \int_0^{\infty} \frac{\ln(u)}{\frac{1}{2}(u^2-1)-u}du.$$
From here, you can extend to $\mathbb{C}$ and pick the appropriate branch of the logarithm  to proceed. EDIT: I actually tried to write the integral out but all my attempts and online integral calculators couldn't solve it. Looking at its graph, I'm now mildly convinced it might actually diverges, but I'd love to see if anyone can take this further or prove that rigorously.
