How to find this complex integral? $I=1/2\pi i\int_C |1+z+z^2|^2dz$ where C denotes the unit circle centered at zero and integral is taken anticlockwise.
I saw that as application of Cauchy Goursat theorem as it seems analytic to me everywhere. So the integral should be zero?

Here's a somewhat unconventional approach: noting that $C$ consists only of $z$ satisfying $|z|^2 = z \bar z = 1 \implies \bar z = 1/z$, we can write
$$
\int_C |1 + z + z^2|^2\,dz =
\int_C \left|\frac{z^3 - 1}{z-1} \right|^2 dz \\
= \int_C \left(\frac{z^3 - 1}{z-1} \right)\overline{\left(\frac{z^3 - 1}{z-1} \right)} \,dz \\
= \int_C \left(\frac{z^3 - 1}{z-1} \right)\left(\frac{z^{-3} - 1}{z^{-1}-1} \right)\,dz \\
= \int_C \frac 1{z^2}\left(\frac{z^3 - 1}{z-1} \right)\left(\frac{1 - z^3}{1 - z} \right)\,dz \\
= \int_C \frac 1{z^2}\left(\frac{z^3 - 1}{z-1} \right)^2dz \\
= \int_C \frac {(1 + z + z^2)^2}{z^2} dz
$$
Now, the Cauchy integral formula applies.
