Solution to the Basel Problem in complex analysis pole issue. Solve:
$$\sum_{n=1}^{\infty} \frac{1}{z^2}$$
Before you mark as duplicate, I have a problem with only the consideration of the pole, please read carefully!
Consider:
$$f(z) = \frac{\pi \cot(\pi z)}{z^2}$$
The obvious three order pole is at $z=0$
But there should be a pole at $z=n?$ because $\frac{1}{\tan(\pi z)}$ doesnt exist for $z \in \mathbb{N}$ 
And there isnt any poles at $z=ni$
Wolframlpha: returns it as saying there is only one pole at $z=0$ I am confused now?
Consider a square:

How would we do this? 
 A: We have the Laurent expansion at $z=0$:
$$
\begin{align}
\frac{\pi\cot(\pi z)}{z^2}
&=\frac\pi{z^2}\frac{\cos(\pi z)}{\sin(\pi z)}\\
&=\frac\pi{z^2}\frac{1-\frac{(\pi z)^2}2+\frac{(\pi z)^4}{24}-\dots}{\pi z\left(1-\frac{(\pi z)^2}6+\frac{(\pi z)^4}{120}-\dots\right)}\\
&=\frac1{z^3}\left(1-\frac{(\pi z)^2}3-\frac{(\pi z)^4}{45}-\dots\right)\\[6pt]
&=\frac1{z^3}\bbox[5px,border:2px solid #C00000]{-\frac{\pi^2}{3z}}-\frac{\pi^4z}{45}-\dots
\end{align}
$$
Thus, the residue of $\frac{\pi\cot(\pi z)}{z^2}$ at $z=0$ is $-\frac{\pi^2}3$.
Since $\pi\cot(\pi z)$ has residue $1$ at each integer, at $z=n$, where $n$ is a non-zero integer, the residue of $\frac{\pi\cot(\pi z)}{z^2}$ is $\frac1{n^2}$.
Consider
$$
\frac1{2\pi i}\int_\gamma \frac{\pi\cot(\pi z)}{z^2}\,\mathrm{d}z
$$
along the contour
$$
\gamma=Re^{i[0,2\pi]}\cup re^{-i[0,2\pi]}
$$
where $R=\left(n+\frac12\right)\pi\to\infty$ where $n\in\mathbb{Z}$ and $r\to0$. 
The integral along $\gamma$ is the sum of the residues of the singularities inside. The singularities inside the contour are those at the non-zero integers, zero being excluded by the small clockwise circle. That is,
$$
\frac1{2\pi i}\int_\gamma \frac{\pi\cot(\pi z)}{z^2}\,\mathrm{d}z=2\sum_{n=1}^\infty\frac1{n^2}
$$
The integral along the large circle tends to $0$ because $\pi\cot(\pi z)$ is bounded on the whole of the large circle and $\left|\frac1{z^2}\right|=\frac1{R^2}$ on a circle of length $2\pi R$.
The integral along the small clockwise circle is the negative of the residue of the singularity inside; that is, $\frac{\pi^2}3$. Thus,
$$
\frac1{2\pi i}\int_\gamma \frac{\pi\cot(\pi z)}{z^2}\,\mathrm{d}z=\frac{\pi^2}3
$$
Putting these two together, we get
$$
\sum_{n=1}^\infty\frac1{n^2}=\frac{\pi^2}6
$$
