<s>[INST] Applying Cauchy's integral formula I'm trying to compute $$\int_\gamma \frac{z^4+z^2+1}{z^3-1} \, dz$$ where $\gamma$ is the circle $|z-i|=1$, using Cauchy's integral formula
My solution is as follows:
The integral can be rewritten as $$\int_\gamma \frac{\frac{z^4+z^2+1}{(z-1)\left(z+\frac{1}{2}-\frac{\sqrt{3}}{2}i\right)}}{z+\frac{1}{2}-\frac{\sqrt{3}}{2}i} \, dz = I$$
Then Cauchy's integral formula can be applied, giving $$I=2\pi if\left(-\frac{1}{2}+\frac{\sqrt{3}}{2}i\right)=0$$
Is this correct?
 [/INST] It is almost correct. The only small problem is that, when you wrote$$\require{cancel}\frac{\ \frac{z^4+z^2+1}{(z-1)\left(z+\frac12\color{red}-\frac{\sqrt3}2i\right)}\ }{z+\frac12-\frac{\sqrt3}2i},$$you should have written$$\frac{\ \frac{z^4+z^2+1}{(z-1)\left(z+\frac12\color{red}+\frac{\sqrt{3}}{2}i\right)}\ }{z+\frac12-\frac{\sqrt3}2i}.\tag1$$But I suppose that that was a typo.
However there is an easier way of computing that integral, which avoids computing the value of the numerator of $(1)$ at $-\frac12+\frac{\sqrt2}2i$. Note that\begin{align*}\frac{z^4+z^2+1}{z^3-1}&=\frac{\frac{z^6-1}{z^2-1}}{z^3-1}\\&=\frac{\frac{z^6-1}{z^3-1}}{z^2-1}\\&=\frac{z^3+1}{z^2-1}.\end{align*}Since the distance from $\pm1$ to $i$ is greater than $1$, it follows from Cauchy's integral theorem that your integral is equal to $0$.
Note: That final rational function can be simplified further:\begin{align}\frac{z^3+1}{z^2-1}&=\frac{\cancel{(z+1)}(z^2-z+1)}{\cancel{(z+1)}(z-1)}\\&=\frac{z^2-z+1}{z-1}.\end{align}
</s>