$\frac{1}{\sinh^2(x)} = \frac{4}{(e^{x} - e^{-x})^2} = \frac{4e^{2x}}{(e^{2x} - 1)^2} = \frac{4e^{2x}}{(1 - e^{2x})^2}$.
But $\int dx \frac{1}{\sinh^2(x)} = -\coth(x) = \frac{e^x + e^{-x}}{e^{-x} - e^x}$
and $\int dx \frac4{(e^{x} - e^{-x})^2} = \int dx \frac{4e^{2x}}{(e^{2x} - 1)^2} = \int dx \frac{4e^{2x}}{(1 - e^{2x})^2} = \frac{2}{1 - e^{2x}}$,
which is a contradiction, since $\frac{e^x + e^{-x}}{e^{-x} - e^x}\neq \frac2{1 - e^{2x}}$.
I clearly have done something wrong, but I cannot find the mistake. I would appreciate it if someone could resolve this apparent contradiction please.
I can see that the integrand is not defined at $0$, but not sure if that matters.
You have\begin{align}\frac{e^x+e^{-x}}{e^{-x}-e^x}&=\frac{e^{2x}+1}{1-e^{2x}}\\&=\frac{e^{2x}-1+2}{1-e^{2x}}\\&=-1+\frac2{1-e^{2x}},\end{align}and therefore $\frac{e^x+e^{-x}}{e^{-x}-e^x}$ and $\frac2{1-e^{2x}}$ differ by a constant. So, there is no contradiction here.