Why is $\int_{-\infty}^\infty \frac{1}{\sinh^2(t-i)} dt = -2$? Mathematica says that
$$\int_{-\infty}^\infty \frac{1}{\sinh^2(t-i)} dt = -2,$$
where $i=\sqrt{-1}$. Why is this true?
I tried to use complex analytic method, but $1/\sinh z$ function has too many poles, and it does not decay at either upper or lower half plane.
 A: $$\int\frac{1}{\sinh^2(t-i)} dt=\int\frac{1}{\sinh^2(x)} dx=-\coth (x)=-i \cot (1+i t) $$ Expanding the complex and using the double angle formulae
$$I=-i \cot (1+i t)= \frac{\sinh (2 t)}{\cos (2)-\cosh (2 t)}+i\frac{ \sin (2)}{\cos (2)-\cosh (2 t)}$$
When $t \to \pm\infty$, the imaginary part tends to $0$ and the real part
$$\frac{\sinh (2 t)}{\cos (2)-\cosh (2 t)}\sim -\tanh(2t)$$ and then the result.
A: You can just integrate it directly as follows using $\sinh z = \frac 12(e^z-e^{-z})$.
First note that by expanding you get
\begin{eqnarray*}\frac 1{\sinh^2 (t-i)} 
& =  & \frac 4{e^{-2i}e^{2t} + e^{2i}e^{-2t}-2} \\
& =  & \frac {4e^{2i}e^{2t}}{e^{4t} + e^{4i}-2e^{2t}e^{2i}} \\
& =  & \frac {4e^{2i}e^{2t}}{(e^{2t} -e^{2i})^2} \\
\end{eqnarray*}
Now using the substitution $u= e^{2t}$ you get
\begin{eqnarray*} \int_{-\infty}^\infty \frac{1}{\sinh^2(t-i)} 
& = & 2e^{2i}\int_{-\infty}^\infty \frac {2e^{2t}dt}{(e^{2t}-e^{2i})^2} \\
& = & 2e^{2i}\int_{0}^\infty \frac {du}{(u-e^{2i})^2} \\
& = & 2e^{2i}\left[-\frac 1{u-e^{2i}}\right]_0^{\infty} \\
& = & 2e^{2i}\frac 1{0-e^{2i}} = -2
\end{eqnarray*}
A: As was mentioned by Ninad Munshi in the comments, you can use a rectangular contour.
Let's integrate the function $$f(z) = \frac{z}{\sinh^{2}(z-i)} $$ around a rectangular contour with vertices at $z= \pm R$, $z= \pm R + \pi i $.
The only pole inside the contour is a double pole at $z=i$.
As $R \to \infty$, the integral vanishes on the vertical sides of the contour because the magnitude of the hyperbolic sine function grows exponentially as $\Re(z) \to \pm \infty$.
And since $\sinh^{2}(z-i)$ is $\pi$-periodic in the imaginary direction, we get $$\int_{-\infty}^{\infty} \frac{t}{\sinh^{2}(t-i)} \, \mathrm dt -  \int_{-\infty}^{\infty}\frac{t+ \pi i}{\sinh^{2}(t-i)} \, \mathrm dt = - \pi i  \int_{0}^{\infty}\frac{dt}{\sinh^{2}(t-i)} = 2 \pi i \operatorname{Res}[f(z), i].$$
The coefficients of the Laurent series of $\frac{1}{\sinh^{2}(z-i)}$ at $z=i$ are the same as the coefficients of the Laurent series of $\frac{1}{\sinh^{2}(z)}$ at $z=0$.
Therefore, $$f(z) = \left(i+(z-i) \right)\left(\frac{1}{(z-i)^{2}} + \mathcal{O}(1)\right) = \frac{i}{(z-i)^{2}} + \frac{1}{(z-i)} + \mathcal{O}(1),$$ which means $$ \operatorname{Res}[f(z), i] = 1$$
and $$\int_{0}^{\infty} \frac{dt}{\sinh^{2}(t-i)} = -\frac{2 \pi i (1)}{\pi i} = -2. $$
