I need to find the residue at $\infty$ of $$f(z)=\frac{\sin(\pi z)}{z^2(z-1)}$$ I wrote the function as $$f(z)=\frac{g(z)}{z} \hspace{1cm} \text{given}\hspace{5mm} g(z) = \frac{\sin(\pi z)}{z(z-1)} \quad \text{which is analytic at z=0}$$
Since $z=0$ is a simple pole for $f(z)$ I evaluated the limit as $z\rightarrow0$ which gives $-\pi$.
Now to evaluate the reside at $\infty$ I used the substitution $z=\frac{1}{w}$ and evaluated the $\text{Res} \{ \frac{1}{w^2} f(\frac{1}{w}); w=0\}$, but $$\frac{1}{w^2}f(\frac{1}{w})=w\frac{\sin\left(\frac{\pi}{w}\right)}{1-w}$$
It has residue equals $0$ at $w=0$. The residue at $\infty$ should be equals to the sums of all the residues of the finite poles changed by a minus, in our case should be $\pi$.
I don't know if I'm using the definition wrong or if there's a mistake in the procedure, please help me find the error.
Let $f(z)=\frac{\sin(\pi z)}{z^2(z-1)}$. Then, we can write
$$\begin{align} \text{Res}\left(f(z), z=\infty\right)&=\text{Res}\left(-\frac1{z^2}f(1/z), z=0\right)\\\\ &=\text{Res}\left(\frac{z\sin(\pi/z)}{z-1}, z=0\right) \end{align}$$
Note that $\sin(\pi/z)$ has an essential singularity at $z=0$ and thus $\hat f(z) =\frac{z\sin(\pi/z)}{z-1}$ also has an essential singularity at $z=0$. In fact, its value as $z\to 0$ takes on all possible values and therefore its limit fails to converge. Moreover, its residue is not equal to zero (A function with an essential singularity can have zero residue.).
To compute the reside of $\hat f(z)=\frac{z\sin(\pi/z)}{z-1}$ at $z=0$, we expand $\hat f(z)$ in a Laurent series. Proceeding we have
$$\begin{align} \hat f(z)&=\left(1-\sum_{m=0}^\infty z^m\right)\left(\sum_{n=0}^\infty \frac{(-1)^{n}(\pi/z)^{2n+1}}{(2n+1)!}\right)\\\\ &=\sum_{n=0}^\infty \frac{(-1)^{n}(\pi/z)^{2n+1}}{(2n+1)!}-\left(\sum_{m=0}^\infty z^m\right)\left(\sum_{n=0}^\infty \frac{(-1)^{n}(\pi/z)^{2n+1}}{(2n+1)!}\right)\\\\ &=\sum_{n=0}^\infty \frac{(-1)^{n}(\pi/z)^{2n+1}}{(2n+1)!}-\sum_{p=0}^\infty \sum_{q=0}^p \frac{(-1)^q(\pi)^{2q+1}}{(2p+1)!}z^{p-3q-1}\tag1 \end{align}$$
The reside of the first series on the right-hand side of $(1)$ is easily seen to be equal to $\pi$. For the second term, note that only those terms for which $p=3q$ are implicated. But in that case, the result is $\sum_{q=0}^\infty \frac{(-1)^q(\pi)^{2q+1}}{(2q+1)!}=\sin(\pi)=0$.
Hence, we find that
$$\text{Res}\left(\frac{\sin(\pi z)}{z^2(z-1)}, z=\infty\right)=\pi$$
as was expected!