Integral $\int_0^\infty \frac{\sin^2 ax}{x(1-e^x)}dx=\frac{1}{4}\log\left( \frac{2a\pi}{\sinh 2a\pi}\right)$ How can we prove this ${\it{interesting}}$ integral
$$
I:=\int_0^\infty \frac{\sin^2 ax}{x(1-e^x)}dx=\frac{1}{4}\log\left( \frac{2a\pi}{\sinh 2a\pi}\right)
$$
I to write
$$
I=\frac{1}{2}\int_0^\infty \frac{(1-\cos a x)}{x}dx \sum_{n=0}^\infty e^{nx}
$$
simplifying
$$
I=\frac{1}{2} \int_0^\infty \sum_{n=0}^\infty e^{nx}\frac{dx}{x} -\frac{1}{2}\int_0^\infty \frac{\cos a x}{x}dx \sum_{n=0}^\infty e^{nx}
$$
but didn't help much.  Thank you
 A: $$
\begin{aligned}
\frac{1}{2}{\frac {\partial }{\partial a}}\int _{0}^{\infty }\!{\frac {\cos
 \left( 2\,ax \right) -1}{x \left( -1+{{\rm e}^{x}} \right) }}{dx}&=
\int _{0}^{\infty }\!{\frac {\sin \left( 2\,ax \right) }{1-{{\rm e}^{x
}}}}{dx}\\
&=\mathcal{Im} \left( \int _{0}^{\infty }\!-{\frac {{{\rm e}^{2\,iax}}}{-1+{
{\rm e}^{x}}}}{dx} \right) \\
&=\mathcal{Im}\left(\sum _{n=0}^{\infty } \left( \int _{0}^{\infty }\!{{\rm e}^{2\,iax}}{
{\rm e}^{-xn}}{dx} \right)\right)\\
&=\frac{1}{2}\,i\sum _{n=1}^{\infty } \left(  \frac{1}{\left( 2\,ia-n \right)} 
 \frac{1}{\left( -2\,ia-n \right)} \right)\\
&=\frac{1}{4\,a}+\frac{\pi}{2} \,\coth \left( 2\,\pi \,a \right)   
\end{aligned}$$
Integrating with respect to $a$ gives:
$$\begin{aligned}
\int_0^\infty \frac{\sin^2 ax}{x(1-e^x)}dx&=\int \!\frac{1}{4\,a}+\frac{\pi}{2} \,\coth \left( 2\,\pi \,a \right) {da}\\
&=\frac{1}{4}\,\ln  \left( 2\,\pi \,a \right) +\frac{1}{4}\,\ln  \left( \sinh \left( 2\,
\pi \,a \right)  \right)+K\\
&=\frac{1}{4}\,\ln  \left( \frac{2\,\pi \,a }{\sinh \left( 2\,
\pi \,a \right) }\right)+K 
\end{aligned}$$ 
and the constant of integration $K$, is zero as: $$\lim _{a\rightarrow 0}{\frac {2\pi \,a}{\sinh \left( 2\,\pi \,a
 \right) }}=1,\quad \lim_{a=0}\,\sin^2(ax)=0$$
The integral:
$$\int _{0}^{\infty }\!-{\frac {{{\rm e}^{2\,iax}}}{-1+{
{\rm e}^{x}}}}{dx} $$
can also be evaluated by comparing it to the difference of two digamma functions and then the $\coth$ function appears using the reflection formula for the digamma function.
A: Consider the integral
\begin{align}
I = \int_{0}^{\infty} \frac{\sin^{2}(ax)}{x(1-e^{x})} \ dx.
\end{align}
This can be seen as
\begin{align}
- I &= \int_{0}^{\infty} \frac{ e^{-x} \sin^{2}(ax) }{ x ( 1 - e^{-x}) } \ dx \\
&= \sum_{n=0}^{\infty} \ \int_{0}^{\infty} e^{-(n+1)x} \sin^{2}(ax) \ \frac{dx}{x} \\
&= \sum_{n=0}^{\infty} I_{n}
\end{align}
where $I_{n}$ is given by
\begin{align}
I_{n} = \int_{0}^{\infty} e^{-(n+1)x} \sin^{2}(ax) \ \frac{dx}{x}.
\end{align}
Now $I_{n}$ can be evaluated as follows.
\begin{align}
\partial_{n} I_{n} &= - \int_{0}^{\infty} e^{-(n+1)x} \sin^{2}(ax) \ dx \\
&= - \frac{1}{2} \ \int_{0}^{\infty} e^{-(n+1)x} (1 - \cos(2ax)) \ dx \\
&= - \frac{1}{2} \left[ \frac{1}{n+1} - \frac{(n+1)}{4a^{2} + (n+1)^{2}} \right] 
\end{align}
and upon integration yields
\begin{align}
I_{n} &= - \frac{1}{2} \ln(n+1) + \frac{1}{4} \ln (4 a^{2} + (n+1)^{2}) \\
&= \frac{1}{4} \ln\left( \frac{4 a^{2} + (n+1)^{2}}{(n+1)^{2}} \right). 
\end{align}
Now, returning to the summation, it is seen that
\begin{align}
- I &= \frac{1}{4} \sum_{n=0}^{\infty} \ln\left( \frac{4 a^{2} + (n+1)^{2}}{(n+1)^{2}} \right) \\
&= \frac{1}{4} \ln \left( \prod_{n=0}^{\infty} \left\{ \frac{4 a^{2} + (n+1)^{2}}{(n+1)^{2}} 
\right\} \right).
\end{align}
Using the product formula
\begin{align}
\frac{\sinh(x)}{x} = \prod_{k=1}^{\infty} \left( 1 + \frac{x^{2}}{k^{2} \pi^{2}} \right)
\end{align}
then the final result is
\begin{align}
I = \frac{1}{4} \ln \left( \frac{2 a \pi}{\sinh(2a \pi)} \right). 
\end{align}
Hence,
\begin{align}
\int_{0}^{\infty} \frac{\sin^{2}(ax)}{x(1-e^{x})} \ dx = \frac{1}{4} \ln \left( \frac{2 a \pi}
{\sinh(2a \pi)} \right).
\end{align}
A: $\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{\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]{\vphantom{\large A}\,#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}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{I\equiv\int_{0}^{\infty}{\sin^{2}\pars{ax} \over x\pars{1 - \expo{x}}}\,\dd x
     ={1 \over 4}\,\ln\pars{2a\pi \over \sinh\pars{2a\pi}}:\ {\large ?}}$

\begin{align}
I&=\half\,\Re\int_{0}^{\infty}
{1 - \expo{2\ic ax} \over 1 - \expo{x}}\,\int_{0}^{\infty}\expo{-xt}\,\dd t\,\dd x
=-\,\half\,\Re\int_{0}^{\infty}
\int_{0}^{\infty}{\pars{1 - \expo{2\ic ax}}\expo{-x} \over 1 - \expo{-x}}\,
\expo{-tx}\,\dd x\,\dd t
\\[3mm]&=-\,\half\,\Re\int_{0}^{\infty}
\sum_{n = 0}^{\infty}\int_{0}^{\infty}\bracks{%
\expo{-\pars{n + 1 + t}x} - \expo{-\pars{n + 1 + t - 2\ic a}x}}\,\dd x\,\dd t
\\[3mm]&=-\,\half\,\Re\int_{0}^{\infty}\sum_{n = 0}^{\infty}\bracks{%
{1 \over n + 1 + t} - {1 \over n + 1 + t - 2\ic a}}\,\dd x\,\dd t
\\[3mm]&=-\,\half\,\Re\int_{0}^{\infty}\bracks{{1 \over -2\ic a}
\sum_{n = 0}^{\infty}{1 \over \pars{n + 1 + t}\pars{n + 1 + t - 2\ic a}}}\,\dd t
\\[3mm]&=\half\,\Re\int_{0}^{\infty}\bracks{\Psi\pars{1 + t} - \Psi\pars{1 + t - 2\ic a}}
\,\dd t
\end{align}
  where $\ds{\Psi\pars{z} \equiv \totald{\ln\pars{\Gamma\pars{z}}}{z}}$ is the
  Digamma Function ${\bf\mbox{6.3.1}}$ and we have used the identity ${\bf\mbox{6.3.16}}$. $\ds{\Gamma\pars{z}}$ is the
  Gamma Function ${\bf\mbox{6.1.1}}$.

With Stirling Asymptotic Formula
${\bf\mbox{6.1.41}}$:
$$
I=\half\,\bracks{\overbrace{%
\Re\lim_{t \to \infty}\ln\pars{\Gamma\pars{1 + t} \over \Gamma\pars{1 + t - 2\ic a}}}
^{\ds{=\ 0}}
+\Re\ln\pars{\Gamma\pars{1 - 2\ic a}}}
$$

With identities
  ${\bf\mbox{6.1.28}}$ and ${\bf\mbox{6.1.29}}$:
  \begin{align}
I&=\half\,{\ln\pars{\Gamma\pars{1 - 2\ic a}\Gamma\pars{1 + 2\ic a}} \over 2}
={1 \over 4}\,
\ln\pars{\pars{-2\ic a}\Gamma\pars{-2\ic a}\pars{2\ic a}\Gamma\pars{2\ic a}}
\\[3mm]&={1 \over 4}\,\ln\pars{4a^{2}\verts{\Gamma\pars{2\ic a}}^{2}}
={1 \over 4}\,\,\ln\pars{4a^{2}\,{\pi \over 2a\sinh\pars{2\pi a}}}
\end{align}

$$\color{#00f}{\large%
I\equiv\int_{0}^{\infty}{\sin^{2}\pars{ax} \over x\pars{1 - \expo{x}}}\,\dd x={1 \over 4}\,\ln\pars{2a\pi \over \sinh\pars{2a\pi}}}
$$
