TITLE: Evaluating $\int_0^\infty \left( \frac{x}{e^x-e^{-x}}-\frac{1}{2} \right) \frac{dx}{x^2}$
QUESTION [8 upvotes]: Evaluating $$\int_0^\infty \left( \frac{x}{e^x-e^{-x}}-\frac{1}{2} \right) \frac{dx}{x^2}$$

I tried to calculate it by Mathematica, but it failed to give me an answer.
Then I got interested in this problem because it actually can be well evaluated.
My attempt
Put
$$
g(x)=\frac{1}{x}\left(\frac{1}{e^x-1}-\frac{1}{x}+\frac{1}{2}e^{-x}\right)
$$
Considering that
$$
\left( \frac{x}{e^x-e^{-x}}-\frac{1}{2} \right) \frac{1}{x^2}
=
-\frac{1}{2x}\left(e^{-x}-e^{-2x}\right)
+ g(x)-2g(2x)
$$
and
$$
\int_0^\infty g(x) dx = 2 \int_0^\infty g(2x) dx
$$
thus via Frullani's integral we have
$$
\int_0^\infty \left( \frac{x}{e^x-e^{-x}}-\frac{1}{2} \right) \frac{dx}{x^2}
=
-\frac{1}{2} \int_0^\infty \frac{1}{x}\left(e^{-x}-e^{-2x}\right)
=-\frac{1}{2} \log 2
$$
But I am looking forward to other approaches, beacuse this method doesn't seem quite natural. And I would highly appreciate it if you could share any thoughts on how to solve this problem. Thanks in advance!

REPLY [4 votes]: This integral is
$$
\frac{1}{4}\int_{-\infty}^\infty \frac{x\,\mathrm{csch}(x)-1}{x^2}dx
$$
This function is analytic on $\mathbb R$, but $\mathrm{csch}$ still has an infinite number of poles in $\mathbb C$ at $i\pi \mathbb Z$. The residue at each of these poles is $(-1)^n/(in\pi)$, so doing the standard contour around the upper half-plane gives
$$
\frac{1}{4}\int_{-\infty}^\infty \frac{x\,\mathrm{csch}(x)-1}{x^2}dx = \frac{2\pi i}{4}\sum_{n=1}^\infty\frac{(-1)^n}{in\pi} = \frac{1}{2}\sum_{n=1}^\infty \frac{(-1)^n}{n} = -\frac{1}{2}\ln(2).
$$
(This is admittedly trickier than I made it out to be as the error estimates on the contour need to be done more carefully than the usual case, but it's not too hard to work out.)