I've been set a question where I'm asked to classify all of the singularities of
$$f(z) = \frac{z^2 - z}{1-\sin{z}}$$
and then calculate the residue of each of its singularities. I've found the singularities, all of which are of the form $ z_k =(2k + \frac{1}{2})\pi$, where $k$ is an integer, and shown each of these to be double poles.
I have the formula for the residue of $f$ at $z_k$ as
$$\lim\limits_{z \to z_k} (\frac{d}{dz}((z-z_k)^2f(z))$$
(since $z_k$ is a pole of order 2) but it ends up being really complicated and I can't seem to make it work. Is there a better way to do it?
I'm going to write the computation for the pole $z_0:=\frac{\pi}{2}$. You should be able to generalize it for all the other poles. First of all we need to check that indeed $f$ has a pole of order $2$ around $z_0$. To do this let $g(z):=z^2-z$ and $h(z):=1-\sin(z)$. Then, notice that near $z_0$ one has $$ f(z)=\frac{g(z)}{\frac{h''(z_0)}{2!}(z-z_0)^2+\frac{h^{(4)}(z_0)}{4!}(z-z_0)^4 + \frac{h^{(6)}(z_0)}{6!}(z-z_0)^6 + \cdots} $$ Thus, $$ (z-z_0)^2 f(z)= \frac{g(z)}{\frac{h''(z_0)}{2!}+\frac{h^{(4)}(z_0)}{4!}(z-z_0)^2 + \frac{h^{(6)}(z_0)}{6!}(z-z_0)^4 + \cdots}, $$ and therefore $$ \lim_{z \to z_0} (z-z_0)^2 f(z) = 2\frac{g(z_0)}{h''(z_0)}=\frac{\pi^2-2\pi}{2} $$ This shows that $f$ has indeed a pole of order $2$ around $z_0.$ Now if we let $$ k(z):=\frac{h''(z_0)}{2!}+\frac{h^{(4)}(z_0)}{4!}(z-z_0)^2 + \frac{h^{(6)}(z_0)}{6!}(z-z_0)^4 + \cdots, $$ we have that $(z-z_0)^2 f(z)=\frac{g(z)}{k(z)}$, and therefore $$ \frac{d}{dz}(z-z_0)^2 f(z) = \frac{g'(z)k(z)-g(z)k'(z)}{(k(z))^2} $$ Note that $k(z_0)=\frac{h''(z_0)}{2!}=\frac{1}{2}$, $k'(z_0)=0$ and that $g'(z_0)=\pi-1$. Hence, the residue at $z_0$ is $$ \lim_{z \to z_0} \left( \frac{d}{dz}(z-z_0)^2 f(z) \right) = \frac{g'(z_0)\frac{h''(z_0)}{2!}}{\left( \frac{h''(z_0)}{2!} \right)^2}=\frac{\frac{\pi-1}{2}}{\left( \frac{1}{2} \right)^2} = 2(\pi-1) $$