Computing the residue of $\frac{\cot(\pi z)}{z^2}$ at pole $z=0$ To find the residue I used the residue theorem that states:
$$Res(f,z_0)=\frac{1}{(m-1)!}\lim_{z\to0}\frac{\mathrm{d}^{m-1}}{\mathrm{d}z^{m-1}}(z-z_0)^m f(z)$$ where $m$ is the order 
Computing the Residue of $\dfrac{\cot(\pi z)}{z^2}$ 
This is what I thought I was supposed to do for the singularity at $z_0=0$ of order $3$.
$$Res(f;0)=\frac{1}{2!}\lim_{z\to 0} \frac{\mathrm{d}^2}{\mathrm{d}z^2}z^2 \sin(\pi z)f(z)=-\frac{1}{2}\lim_{z \to 0} \pi^2 \cos(\pi z) =-\frac{\pi^2}{2}$$
However the answer is $-\dfrac{\pi}{3}$
I'd really appreciate any guidance in where I went wrong. 
 A: If one wishes to proceed using the limit formula for higher order poles, then one can write
$$\begin{align}
\text{Res}\left(\frac{\cot(\pi z)}{z^2},z=0\right)&=\frac12 \lim_{z\to 0}\frac{d^2}{dz^2}\left(z^3\,\frac{\cot(\pi z)}{z^2}\right)\\\\
&=\frac12 \lim_{z\to 0}\frac{d^2(z\cot(\pi z))}{dz^2}\\\\
&=\frac12 \lim_{z\to 0}\left(2\pi \frac{(\pi z)\cos(\pi z)-\sin(\pi z)}{\sin^3(\pi z)}\right)\\\\
&=\pi \lim_{z\to 0} \left(\frac{(\pi z)-\frac12 (\pi z)^3+O\left(z^4\right)-(\pi z)+\frac16 (\pi z)^3+O\left(z^5\right)}{(\pi z)^3+O\left(z^4\right)}\right)\\\\
&=-\frac{\pi}{3}
\end{align}$$
as expected!
However, since the residue is the coefficient of the $z^{-1}$ term in the Laurent expansion, one can proceed as
$$\begin{align}
\frac{\cot(\pi z)}{z^2}&=\frac{1-\frac12 (\pi z)^2+O\left(z^4\right)}{\pi z^3-\frac16 \pi^3z^5+O\left(z^7\right)}\\\\
&=\frac{\left(1-\frac12 (\pi z)^2+O\left(z^4\right)\right)\left(1+\frac16 (\pi z)^2+O\left(z^4\right)\right)}{\pi z^3}\,\\\\
&=\frac{1}{\pi z^3}-\frac{\pi/3}{z}+O(z)
\end{align}$$
where we see that the residue is indeed $-\pi/3$.
A: There is not quite enough shown of your work to figure out where the error is. However, I have used the same approach below, so perhaps you can find the step that differs.
$$
\begin{align}
&\frac12\frac{\mathrm{d}^2}{\mathrm{d}z^2}\left(z^3\frac{\cot(\pi z)}{z^2}\right)\\
&=\frac12\frac{\mathrm{d}^2}{\mathrm{d}z^2}\left(\frac{z\cos(\pi z)}{\sin(\pi z)}\right)\tag1\\
&=\frac12\frac{\mathrm{d}}{\mathrm{d}z}\left(\frac{\sin(\pi z)\cos(\pi z)-\pi z}{\sin^2(\pi z)}\right)\tag2\\
&=\pi\left(\frac{\pi z\cos(\pi z)-\sin(\pi z)}{\sin^3(\pi z)}\right)\tag3\\
&=\pi\left(\frac{\pi z\cos^2(\pi z)-\sin(\pi z)\cos(\pi z)}{\sin(\pi z)\cos(\pi z)\left(1-\cos^2(\pi z)\right)}\right)\tag4\\
&=\pi\left(\frac{\pi z\left(\cos^2(\pi z)\color{#C00}{-1}\right)+\pi z(\color{#C00}{1}-\color{#090}{\cos(\pi z)})-(\sin(\pi z)-\color{#090}{\pi z})\cos(\pi z)}{\sin(\pi z)\cos(\pi z)\left(1-\cos^2(\pi z)\right)}\right)\tag5\\
&=\pi\left(-\frac{\pi z}{\sin(\pi z)\cos(\pi z)}+\frac{\pi z}{\sin(\pi z)\cos(\pi z)(1+\cos(\pi z))}+\frac{\pi z-\sin(\pi z)}{\sin^3(\pi z)}\right)\tag6\\
&\to\pi\left(-1+\frac12+\frac16\right)\tag7\\[6pt]
&=-\frac\pi3\tag8
\end{align}
$$
Explanation:
$(1)$: simplify
$(2)$: take the derivative
$(3)$: take another derivative
$(4)$: apply $\sin^2(\pi z)=1-\cos^2(\pi z)$ and multiply by $\frac{\cos(\pi z)}{\cos(\pi z)}$
$(5)$: add and subtract the red and green terms
$(6)$: separate and simplify the summands in the numerator
$(7)$: evaluate the limits using $\lim\limits_{x\to0}\frac{x}{\sin(x)}=1$ from this answer
$\phantom{\text{(7):}}$ and $\lim\limits_{x\to0}\frac{x-\sin(x)}{x^3}=\frac16$ from this answer
