Well, this is a question from Conway's book. Anyway:
We assert that
$$
\lim _{n \rightarrow \infty} \int_{\gamma} \frac{\pi \cot \pi z}{(z+a)^{2}} d z=0
$$
In effect, let $z=x+y i$, then
$$
|\cot \pi z|^{2}=\frac{\cos ^{2} \pi x+\sinh ^{2} \pi y}{\sin ^{2} \pi x+\sinh ^{2} \pi y}
$$
Let $L_{n}=\left[n+\frac{1}{2}-n i, n+\frac{1}{2}+n i\right]$ be the right side of $\gamma$. So if $ z \in\left\{L_{n}\right\}$, $\cos \pi x=0$ and $\sin \pi x= \pm 1$ then
$$
z \in\left\{L_{n}\right\} \Longrightarrow|\cot \pi z|^{2}=\frac{\sinh ^{2} \pi y}{1+\sinh ^{2} \pi y} \leq 1
$$
Hence,
$$
\begin{aligned}
\left|\int_{L_{n}} \frac{\pi \cot \pi z}{(z+a)^{2}} d z\right| & \leq \pi \frac{\max _{z \in\left\{L_{n}\right\}}|\cot \pi z|}{\min _{z \in\left\{L_{n}\right\}}|z+a|^{2}} \ell\left(L_{n}\right) \\
& \leq \pi \frac{1}{\left(n+\frac{1}{2}+\operatorname{Re} a\right)^{2}} 2 n\longrightarrow 0.
\end{aligned}
$$
when $n \longrightarrow \infty$. Likewise for $L_{n}=\left[-n-\frac{1}{2}+n i,-n-\frac{1}{2}-n i\right]$ the left side of $\gamma$, then
$$
\int_{L_{n}} \frac{\pi \cot \pi z}{(z+a)^{2}} d z \longrightarrow 0 \text { quando } n \longrightarrow \infty.
$$
Now, consider $L_{n}=\left[n+\frac{1}{2}+n i,-n-\frac{1}{2}+n i\right]$, top side of $\gamma$ . If $z \in\left\{L_{n}\right\}$, we have
$$
|\cot \pi z|^{2}=\frac{\cos ^{2} \pi x+\sinh ^{2} n \pi}{\sin ^{2} \pi x+\sinh ^{2} n \pi} \leq \frac{1+\sinh ^{2} n \pi}{0+\sinh ^{2} n \pi}=1+(\sinh n \pi)^{-2}
$$
Then,
$$
\begin{aligned}
\left|\int_{L_{n}} \frac{\pi \cot \pi z}{(z+a)^{2}} d z\right| & \leq \pi \frac{\max _{z \in\left\{L_{n}\right\}}|\cot \pi z|}{\min _{z \in\left\{L_{n}\right\}}|z+a|^{2}} \ell\left(L_{n}\right)\leq \pi \frac{1+(\sinh n \pi)^{-2}}{(n+\operatorname{Im} a)^{2}}(2 n+1)\longrightarrow0
\end{aligned}
$$
when $n\longrightarrow\infty$.
On the other hand, see that there are poles within $\gamma$ located in the integers $k=-n, \ldots, n$ and when $n$ is large enough, an additional pole located in $-a$. If $-n \leq k \leq n$, then
$$
\lim _{z \rightarrow k} \frac{\sin \pi z}{z-k}=\lim _{z \rightarrow k} \frac{\sin \pi z-\sin \pi k}{z-k}=\left.\frac{d}{d z} \sin \pi z\right|_{z=k}=\pi \cos \pi k.
$$
Hence,
$$
\operatorname{Res}\left(\frac{\pi \cot \pi z}{(z+a)^{2}}, k\right)
=\lim _{z \rightarrow k}(z-k) \frac{\pi \cot \pi z}{(z+a)^{2}}
=\lim _{z \rightarrow k} \frac{\pi \cos \pi z}{(z+a)^{2}} \frac{1}{\frac{\sin \pi z}{z-k}}
=\frac{1}{(k+a)^{2}},
$$
and
\begin{align*}
\operatorname{Res}\left(\frac{\pi \cot \pi z}{(z+a)^{2}}, -a\right)
=\left((z+a)^2\frac{\pi\cot \pi z}{(z+a)^2}\right)'(-a)
&=\left(\pi\cot \pi z\right)'(-a)\\
&=\pi^2\sin^{-2}(-a\pi)\\
&=-\pi^2\sin^{-2}(a\pi).
\end{align*}
Follows, by the Residue Theorem, that
\begin{align*}
0=\lim_{n\to\infty}\int_\gamma\pi\frac{\cot(\pi z)}{(z+a)^2}
&=\lim_{n\to\infty}\left[\sum_{k=-n}^n\frac{1}{(k+a)^{2}}-\pi^2\sin^{-2}(a\pi)\right]\\
&=\sum_{n=-\infty}^\infty\frac{1}{(n+a)^{2}}-\pi^2\sin^{-2}(a\pi).
%&=\pi^2\sin^{-2}(a\pi)+\sum_{n=-\infty}^\infty\frac{1}{(-n+a)^{2}}\\
%&=\pi^2\sin^{-2}(a\pi)+\sum_{n=-\infty}^\infty\frac{1}{(n+a)^{2}}
\end{align*}