In a past exam question we prove that the following function is well-defined and holomorphic on $\mathbb{C}$ \ $\mathbb{Z}$, and then we are asked to find the closed form. Let $$ f(z)=\sum_{n=-\infty}^{\infty}\frac{1}{(z+n)^2}. $$
The mark scheme says:
We have that $f$ is periodic as $f(z) = f(z+2) \forall z$. See that $f(z)$ has double poles at every integer with residue $(-1)^k$.
$(*)$ Note that $f(z) = −g'(z)$, where $g(z)$ has single poles with residue $(−1)^k$ at each integer. Then by periodicity it follows that $g(z) = \frac{\pi}{sin(\pi z)}$ and we obtain $f$ by differentiating.
I honestly have no idea why this argument is right. I can see why $f$ is periodic and its residues are as given but everything from $(*)$ is not resonating.
Any help in understanding this would be great! Thanks