# Calculating this integral using Residue Theorem

$$I=\int_{C}\frac{z}{(\sinh z) ^2} \ dz$$
where $C$ is the circle $|z-i\pi| = 1$ taken once anti-clockwise.

I found that the only singularity of $f(z):= \frac{z}{(\sinh z)^2}$ is $z= i\pi$ which is a pole of order $2$.

So then by Residue Theorem,
$$I = 2\pi i\mathrm{Res}(f,i\pi).$$
However, I'm unsure if there's a nice way to calculate this residue:
$$\mathrm{Res}(f,i\pi) = \lim_{z\rightarrow i\pi} \frac{d}{dz} \frac{z}{(\sinh z)^2}(z-i\pi)^2$$

Is there a trick for this integral? Or does the residue calculation simplify nicely? I feel like I'd have to apply L'Hopital's a couple of times.

Since\begin{align}\sinh(z)&=\sinh(z-\pi i+\pi i)\\&=-\sinh(z-\pi i)\\&=-(z-\pi i)-\frac{(z-\pi i)^3}{3!}-\frac{(z-\pi i)^5}{5!}+\cdots,\end{align}we have$$\sinh^2(z)=(z-\pi i)^2+\frac{(z-\pi i)^4}3+\frac{2(z-\pi i)^6}{45}+\cdots$$Therefore,$$\frac z{\sinh^2(z)}=\frac1{(z-\pi i)^2}(a_0+a_1(z-\pi i)+a_2(z-\pi i)^2+\cdots),$$which means that\begin{multline}z=\pi i+(z-\pi i)=\\=(a_0+a_1(z-\pi i)+a_2(z-\pi i)^2+\cdots)\left(1+\frac{(z-\pi i)^2}3+\frac{2(z-\pi i)^4}{45}+\cdots\right).\end{multline}Therefore, $a_1=1$, which means that the residue is $1$.
Let $z=w+i\pi$ and note that $\sinh(z)=\sinh(w+i\pi)=-\sinh(w)$. Moreover recall that $\sinh(w)=w+O(w^3)$ (here we do not need the exact coefficient of $w^3$!). Hence \begin{align}f(z)&=\frac{z}{\sinh^2(z)}=\frac{w+i\pi}{\sinh^2(w)}=\frac{w+i\pi}{\left(w+O(w^3)\right)^2}=\frac{w+i\pi}{w^2+O(w^4)}\\ &=\frac{1/w}{1+O(w^2)}+\frac{i\pi/w^2}{1+O(w^2)} =\frac{1}{w}(1+O(w^2))+\frac{i\pi}{w^2}(1+O(w^2))\\ &=\frac{i\pi}{w^2}+\frac{1}{w}+O(1). \end{align} Therefore the residue of $f(z)$ at $z=i\pi$ is the coefficient of $1/(z-i\pi )=1/w$ that is $1$.