I am reading Serre's 'A course in Arithmetic' and got stuck in his Theorem 6 (Jacobi) on page 95.
Specifically, he defines $$ H_1(z) = \sum_n \sum_m' \frac{1}{(m-1+nz)(m+nz)}, \hspace{5mm} H(z) = \sum_m \sum_n' \frac{1}{(m-1+nz)(m+nz)} $$ where the prime means the sum runs through the pairs $(m,n)\neq (0,0),(1,0)$. He writes: $\textit{The series $H_1$ and $H$ are easy to calculate explicitly because of the formula}$ $$ \frac{1}{(m-1+nz)(m+nz)} = \frac{1}{m-1+nz} - \frac{1}{m+nz} $$ $\textit{One finds that they converge, and that}$ $$ H_1 = 2, \hspace{5mm} H = 2-2\pi i/z $$ I understand the fraction identity, and I see how you obtain $H_1 = 2$, but I can't seem to get the right result for $H$.
Any help is appreciated.
Let's write $A_{m,n}=1/(m+nz)$. Then \begin{align} H(z)&=\sum_{m\ne0,1}\sum_n(A_{m-1,n}-A_{m,n}) +\sum_{n\ne0}(A_{-1,n}-A_{0,n})+\sum_{n\ne0}(A_{0,n}-A_{1,n})\\ &=\sum_{m=2}^\infty\sum_n(A_{m-1,n}-A_{m,n})+ \sum_{m=-\infty}^{-1}\sum_n(A_{m-1,n}-A_{m,n}) +\sum_{n\ne0}(A_{-1,n}-A_{1,n})\\ &=\lim_{M\to\infty}\sum_{n}(A_{1,n}-A_{M,n}) +\lim_{M\to\infty}\sum_{n}(A_{-M,n}-A_{-1,n}) +\sum_{n\ne0}(A_{-1,n}-A_{1,n})\\ &=\lim_{M\to\infty}\sum_{n\ne0}(A_{1,n}-A_{M,n}) +\lim_{M\to\infty}\sum_{n\ne0}(A_{-M,n}-A_{-1,n}) +\sum_{n\ne0}(A_{-1,n}-A_{1,n})\\ &\quad+\lim_{N\to\infty}(A_{1,0}-A_{M,0}) +\lim_{N\to\infty}(A_{-M,0}-A_{-1,0})\\ &=\lim_{M\to\infty}\sum_{n\ne0}(A_{-M,n}-A_{M,n})+2\\ &=2+\lim_{M\to\infty}\sum_{n\ne0}\frac{2M}{n^2z^2-M^2}\\ &=2+\lim_{M\to\infty}\frac1{z}\sum_{n\ne0}\frac{2M/z}{n^2-(M/z)^2}\\ &=2+\frac2z\lim_{M\to\infty}\left(\frac zM-\pi\cot\frac{\pi M}{z}\right).\end{align}
As $z$ is in the upper half plane, $1/z$ is in the lower half plane. Now, $\cot w\to i$ when the imaginary part of $i$ tends to $-\infty$. We conclude that $$H(z)=2-\frac{2\pi i}z.$$