Evaluating an infinite series using contour integral This is a problem from Ph.D qualifying exam of complex analysis.
Determine the value of $\sum_{n=1}^{\infty} \frac{(-1)^n}{n^2}$ by integrating $f(z) = \frac{\pi \csc \pi z }{z^2} $ on an appropriante domain of the complex plane.
My attempt: I already found that for any positive integer $n$, $f$ has a simple pole on $z=n$ and the residue of $f$ on $z=n$ is $\frac{(-1)^n}{n^2}$. Therefore, I think that setting an appropriate contour containing the poles from $z=1$ to $z=n$ and evaluating the contour integral will be helpful. However, I have trouble finding such contour. Does anyone have ideas?
Any advice or hint will be helpful! Thanks!
 A: $$\frac{\pi\csc\pi z}{z^2}=\frac\pi{z^2}\frac1{\sin\pi z}=\frac\pi{z^2}\cdot\frac1{\pi z-\frac{\pi^3z^3}6+\ldots}=\frac1{z^3}\cdot\frac1{1-\frac{\pi^2z^2}6+\ldots}=$$
$$=\frac1{z^3}\cdot\frac1{1-\frac{\pi^2z^2}6\left(1-\frac{\pi^2z^2}{20}+\ldots\right)}=$$
$$=\frac1{z^3}\left(1+\frac{\pi^2z^2}6\left(1-\frac{\pi^2z^2}{20}+\ldots\right)+\frac{\pi^4z^4}{36}\left(1-\frac{\pi^2z^2}{20}+\ldots\right)^2+\ldots\right)=$$
$$=\frac1{z^3}\left(1+\frac{\pi^2z^2}6-\left(\frac1{120}+\frac1{36}\right)\pi^3z^4+\ldots\right)$$
and thus the residue of the function at $\;z=0\;$, a pole of degree three, is $\;\frac{\pi^2}6\;$ . For the simple poles at $\;z=n\,,\,\,0\neq n\in\Bbb Z\;$ , you already found the residue: $\;\frac{(-1)^n}{n^2}\;$ .
Let us now try the rectangular contour which is the perimeter of
$$R_m:=\left\{(x,y)\in\Bbb R^2\cong\Bbb C\;|\;x=\pm\left(m+\frac12\right)\,,\,y=\pm m\right\}$$
Please do observe the perimeter $\;\partial R_m=: C_m\;$ does not cross through any of the function's pole and thus the complex integral $\;\oint_{C_m}f(z)dz\;$ is well defined , and:
$$\oint_{C_m}f(z)dz=\sum_{\text{poles within}\,C_m}Res(f)=\frac{\pi^2}6+2\sum_{k=1}^m\frac{(-1)^k}{k^2}$$
( the $\;2\;$ before the series is because of the positive and negative poles, as the residue at $\;n\;$ equals the residue at $\;-n\;$) Now just take the limit when $\;m\to\infty\;$ , taking into account that that the integral equals zero at the limit (This is a delicate point though not particularly difficult to prove. Anyway, it seems to be you don't need this, but you can read from page 9 on in the paper http://www.supermath.info/InfiniteSeriesandtheResidueTheorem.pdf)
