<s>[INST] Finding residue of complex function, the result is different when using Laurent series and residue theorem. Find the residue of
$$f(z)=\dfrac{z^3+2z+1}{(z-1)(z+3)}$$
on simple pole $z=1$.
If I using residue theorem, I have
\begin{align}
\underset{z=1} {\operatorname{Res}} f(z) =
\lim\limits_{z\to 1} (z-1)\dfrac{z^3+2z+1}{(z-1)(z+3)}=\dfrac{1+2+1}{4}=1.
\end{align}
If I using Laurent series method, I have
\begin{align}
f(z)&=\dfrac{z^3+2z+1}{(z-1)(z+3)}\\
&=(z-2)+\dfrac{9z-5}{(z-1)(z+3)}\\
&= -1+(z-1)+\dfrac{9(z+3)-32}{(z-1)(z+3)}\\
&= -1+(z-1)+\dfrac{9}{(z-1)}-\dfrac{32}{z-1}\cdot\dfrac{1}{z+3}\\
&= -1+(z-1)+\dfrac{9}{(z-1)}-\dfrac{32}{z-1}\cdot\dfrac{1}{z-1+4}\\
&= -1+(z-1)+\dfrac{9}{(z-1)}-\dfrac{32}{(z-1)^2}\cdot\dfrac{1}{1+\dfrac{4}{z-1}}\\
&= -1+(z-1)+\dfrac{9}{(z-1)}-\dfrac{32}{(z-1)^2}\sum\limits_{n=0}^{\infty} (-1)^n \left(\dfrac{4}{z-1}\right)^n\\
&= -1+(z-1)+\dfrac{9}{(z-1)}-\dfrac{32}{(z-1)^2}\sum\limits_{n=0}^{\infty} (-4)^n \left(z-1\right)^{-n}\\
&= -1+(z-1)+\dfrac{9}{(z-1)}+\sum\limits_{n=0}^{\infty} (-32)(-4)^n \left(z-1\right)^{-n-2}.
\end{align}
Now I have coefficient of $(z-1)^{-1}$ is $9$, so we can conclude
\begin{align}
\underset{z=1} {\operatorname{Res}} f(z) =9.
\end{align}
My question
When I using residue theorem and Laurent series method, why the result is distinct? What my mistake in my work?
 [/INST] The "Laurent series method" had an incorrect conclusion going from the fourth to the fifth lines. There was a still an order $1$ term on the far right, it just still had to be pulled out. 
We can calculate the Laurent series another way. From partial fraction decomposition we have that
$$\frac{4}{(z-1)(z+3)} = \frac{1}{z-1}-\frac{1}{z+3}$$
which means we can rewrite the function as
$$f(z) = \frac{z^3+2z+1}{4(z-1)} - \frac{z^3+2z+1}{4(z+3)}$$
This time the term on the far right has no singularity at $z=1$ so it will not contribute to the residue. We will only focus on the term on the left.
Next, shift the variables in the numerator to the desired center:
$$\frac{z^3+2z+1}{4(z-1)} = \frac{(z-1)^3+3(z-1)^2+5(z-1)+4}{4(z-1)}$$
$$ = \frac{1}{4}(z-1)^2+\frac{3}{4}(z-1) + \frac{5}{4} + \frac{1}{z-1}$$
which has a residue of $1$.
</s>