Q:

Method of Limit doesn't seem to work for simple pole

I have the following complex-valued function $$f(z) = \frac{\cos(z)+z^3}{\sin(z)}$$
Now, I have to find the singularities and residues as always. I already know the answer, but using a different method doesn't give me an answer at all (so far).
Clearly $h(z) = \sin(z)$ vanishes for $z=\pi n$ for $n\in\mathbb{Z}$. Also $g(z)=\cos(z)+z^3$ doesn't vanish at those points, i.e. $g(\pi n) = \cos(\pi n)+(\pi n)^3\neq 0$ and finally $h'(\pi n) = \cos(\pi n) \neq 0$.
So I can do the following: $$res(f,\pi n) = \frac{g(\pi n)}{h'(\pi n)} = \frac{(-1)^n+\pi^3n^3}{(-1)^n} = 1 + (-1)^n\pi^3n^3$$
and this gives me the residues.
However normally I can just take the limit and here I get $$\lim_{z\to\pi n}\frac{(z-\pi n)(\cos(z)+z^3)}{\sin(z)}$$ but here I don't know how to solve this. I cannot use Hopital and I don't see any other way of doing it in order to get a finite value, which I should get.

How can I solve this limit? And if I can't, why doesn't it work?

A:

If we replace $z-\pi n=t$ we get:
\begin{equation}
\lim_{t\to 0}{t[\cos(t+\pi n)+(t+\pi n)^3]\over \sin(t+\pi n)}=
\lim_{t\to 0}{(-1)^n\cos t-\sin t\sin(\pi n)+t^3+(\pi n)^3+3t^2\pi n+3(\pi n)^2t\over{(-1)^n\sin t+\cos t\sin(\pi n)\over t}}=\lim_{t\to 0}{(-1)^n\cos t+t^3+(\pi n)^3+3t^2\pi n+3(\pi n)^2t\over{(-1)^n\sin t\over t}}=1+(-1)^n(\pi n)^3
\end{equation}
where we used: $\cos(t+\pi n)=\cos t\cos\pi n-\sin t\sin\pi n=(-1)^n\cos t$ and $(t+\pi n)^3=t^3+(\pi n)^3+3t^2\pi n+3(\pi n)^2t$.

