I'm doing a homework problem, and so far I've proved $\sum_{n=-\infty}^\infty \frac{1}{(z+n)^k}=\frac{(-2\pi i)^k}{(k-1)!}\sum_{m=1}^\infty m^{k-1}e^{2\pi imz}$ for $k$ an integer $\geq 2$ and $\text{Im}(z)>0$. The next part of the problem asks me to put $k=2$ and show $\sum_{n=-\infty}^\infty \frac{1}{(z+n)^2}=\frac{\pi^2}{\sin^2(\pi z)}$ for $\text{Im}(z)>0$, but after nearly an hour of bashing I still see it-- I've tried product expansions of sine, using Euler's formula (which equates to showing $\frac{e^{2\pi ir}+e^{-2\pi ir}-2}{16}=-4\pi^2 \sum_{m=1}^\infty me^{2\pi imz}$). Could anybody point out a way to get the above equality from the one I derived? Apologies in advance if I'm just ditzy and it's really obvious.
Also, the next question asks if the above formula is true if $z$ is any complex number that is not an integer, but I'm not really sure I understand what it's asking. Why wouldn't it be true?