Bounding a function I'm trying to solve for $\sum_{0}^{\infty} \dfrac{1}{n^2}$ using the residue theorem.  The integral in question is $\int_C f(z)\pi \cot(\pi z) dz$ where $f(z)=\dfrac{1}{z^2}$. I am bounding over the square with vertices $\pm (N+1/2)\pm(N+1/2)i$.  Bounding the integrand, I get $\dfrac{1}{z^2} \pi$ * $\dfrac{1+e^{-2\pi y}}{1-e^{-2\pi y}}$. I'm not sure how to get the integral to reduce to 0.  What further bounds/limits should I take?
 A: The cotangent function is given by 
$$\cot (\pi z)=i\left(\frac{e^{i\pi z}+e^{-i\pi z}}{e^{i\pi z}-e^{-i\pi z}}\right)$$
So, on the contour $C_N$, which is the square with vertices $(N+1/2)(1+i)$, $(N+1/2)(-1+i)$, $(N+1/2)(-1-i)$, and $(N+1/2)(1-i)$, we have  
$$\lim_{N\to \infty}\left(\left. \cot (\pi z)\right|_{z\in C_N}\right)=\pm i$$
for the top and bottom parts of $C_N$. For the left and right parts, we exploit the fact that the integrand is an odd function of $z$ and integration over $y$ is from $y=-(n+1/2)$ to $y=n+1/2$.  Therefore integration over the left segment for which $z=-(n+1/2)+iy$ and the right swgment for which $z=(n+1/2)+iy$ cancel.
Therefore, one can easily show that 
$$\lim_{N\to \infty}\oint_{C_N} \frac{\pi \cot (\pi z)}{z^2}\,dz=0$$
We also have by the Residue Theorem that 
$$\lim_{N\to \infty}\oint_{C_N} \frac{\pi \cot (\pi z)}{z^2}\,dz=\lim_{N\to \infty}\sum_{n=-N}^N\text{Res}\left(\frac{\pi \cot (\pi z)}{z^2}, z=n\right)$$
The residues at $n\ne 0$ are easily seen to $1/n^2$.  To evaluate the residue at zero, we can write
$$\begin{align}
\text{Res}\left(\frac{\pi \cot (\pi z)}{z^2}, z=0\right)&=\frac12\lim_{z\to 0}\frac{d^2 }{dz^2}\left(\pi (\pi z)\cot(\pi z)\right)\\\\
&=\pi^2\lim_{z\to 0}\left(\pi z\cot(\pi z)\csc^2(\pi z)-\csc^2(\pi z)\right)\\\\
&=-\frac{\pi^2}{3}
\end{align}$$
Putting it all together, gives the expected result
$$2\sum_{n=1}^\infty\frac{1}{n^2}-\frac{\pi^2}{3}=0\implies \bbox[5px,border:2px solid #C0A000]{\sum_{n=1}^\infty\frac{1}{n^2}=\frac{\pi^2}{6}}$$
