I am trying to prove that $$\sum_{n\in\mathbb{Z}}\frac{1}{(z-n)^2}=\left(\frac{\pi}{\sin \pi z}\right)^2$$ based on some hints.
Let $$f(z)=\sum_{n\in\mathbb{Z}}\frac{1}{(z-n)^2}\hspace{0.5cm}\text{ and }\hspace{0.5cm} g(z)=\left(\frac{\pi}{\sin \pi z}\right)^2$$
The first step is showing that
The Laurent series of both $f$ and $g$ have the same principal part at $z=0$.
I calculated the principal part for $g$ as follows:
$$\frac{\sin \pi z}{\pi}=z\left(1-\frac{\pi^2z^2}{3!}+\frac{\pi^4z^4}{5!}+\dots\right)$$ So near $z=0$ we have $$\frac{\pi}{\sin \pi z}=\frac{1}{z}\left( 1+\frac{\pi^2z^2}{3!}+\dots\right)$$ So $$\frac{\pi}{\sin \pi z}=\frac{1}{z}\left( 1+z^2h_1(z)\right)$$ where $h_1(z)$ is a holomorphic function. Then $$g(z)=\left(\frac{\pi}{\sin \pi z}\right)^2=\frac{1}{z^2}\left(1+z^2h_1(z)\right)^2$$ Hence the principal part of $g(z)$ is $1/z^2$.
According to the calculation above the principal part of $f(z)$ should be $1/z^2$ at $z=0$.
But I don't know how to calculate this principal part. Can you help?
In a neighborhood of $0$, e.g. $|z|<\frac12$, $\displaystyle\sum\limits_{n\in Z\setminus\{0\}}\dfrac{1}{(z-n)^2}$ is a uniformly convergent series of holomorphic functions, hence is holomorphic. That is $f(z)-\dfrac1{z^2}$.