Cauchy's Integral theorem: Let $U$ be a convex open set and suppose $f$ is a function which is analytic on $U$, except possibly at one point, where it is at least continuous. Then $$\int_{\gamma} f(z) dz=0$$ for every closed path in $U$.
Let $\gamma$ trace the unit circle centered at $0+0i$ in the anticlockwise direction on the set $\mathbb{C}$.
Then, $\int_{\gamma} \frac{1}{z^2} dz = 0$, which makes sense.
But then why does $\int_{\gamma} \frac{1}{z} dz = 2\pi i$?
Both $\frac{1}{z}$ and $\frac{1}{z^2}$ are not defined at $z=0$, but then how does Cauchy's theorem only apply to the latter?
In fact Cauchy theorem applies when the open set $U$ is simply connected which is the case of convex sets.
More generally if, on $U$, your function $f$ admits an antiderivative (that is $F$ such that $F'=f$), one has $$ \int_\gamma f(z)dz=0 $$ for arbitrary $U$.
In your case $f(z)=\frac{1}{z^2}$ admits $F(z)=-\frac{1}{z}$ as antiderivative on $\mathbb{C}^*$ whereas $f(z)=\frac{1}{z}$ does not.
In fact, one can prove the following (can be elaborated on request)