I am trying to evaluate the integral $$\int_{0}^{\infty}\frac{\sin^2(x)}{\sinh^2(x)}\;dx$$ by integrating $$f(z)=\frac{1-e^{2iz}}{\sinh^2(z)}$$ over a semicircular contour.
The horizontal segment of the contour returns back 4 times the integral we were looking for. In addition, on the part where we jump over the simple pole at $z=0$, we get a value of $-2\pi$. I checked that the infinite top arc goes to zero.
The residue calculation for the double poles at $z=in\pi$ for $n=1,2,...$ gives me an infinite geometric series. $$-2i\sum_{n=1}^{\infty}e^{-2n\pi}=-2i\frac{e^{-2\pi}}{1-e^{-2\pi}}$$.
All together, I get $$2\int_{0}^{\infty}\frac{1-\cos(2x)}{\sinh^2(x)}\;dx=4\int_{0}^{\infty}\frac{\sin^2(x)}{\sinh^2(x)}\;dx=2\pi+4\pi\frac{e^{-2\pi}}{1-e^{-2\pi}}$$.
But this is still way off from the correct answer of $\frac{1}{2}(-1+\pi\coth(\pi))$.
Maybe semicircular contours is not the ideal method. Rectangular contours results in divergences around the pole at $z=i\pi$. Please help.
Thank you.