Calculate $\int_{|z|=2}\frac{1}{z^3+z^2+z+1}$ I want to calculate $$\int_{|z|=2}\frac{1}{z^3+z^2+z+1}$$
where $|z|=2$ is run counterclockwise.
What I did:  $$\int_{|z|=2}\frac{1}{z^3+z^2+z+1}=\int_{|z|=2}\frac{1}{(z+1)(z^2+1)} $$
Using Cauchy's integral formula
$$f(-1)=\frac{1}{2\pi i}\int_{|z|=2} \frac{f(z)}{z+1}dz$$
where $f(z)=\frac{1}{z^2+1}$
Therefore $$\int_{|z|=2}\frac{1}{z^3+z^2+z+1}=\pi i$$
However I realized that $f$ is not holomorphic in $1,-i,i$ (the roots of $z^3+z^2+z+1$) and this made me doubt my result. What is the correct answer? 

The poles $-1,\,\pm i$ all have modulus $1<2$, so we get contributions from all of them. The poles are also all first-order. The $z=-1$ residue is $\frac{1}{(-1)^2+1}=\frac12$. The $z=\pm i$ residue is $\frac{1}{(1\pm i)(\pm 2i)}=\frac{-1\mp i}{4}$. So the integral is $2\pi i(\frac12+\frac{-1}{2})=0$.
