I understand by some easy calculation that $\int _{|z|=1} \frac{1}{z}dz=2\pi i$. However, I also think that the integral must be equal to $0$ for the following reason:
To integrate a function means to sum its values on “infinitesimal” domains. But for each infinitesimal part of $\frac{1}{z}$, we have exactly the antipodal infinitesimal part with the same amount of infinitesimal domain. It behaves like an odd function. What is wrong in my thinking?
Your notation $\int_{|z|=1} \frac{1}{z} dz$ is ambiguous. Remember that complex integrals are defined over a curve (path) with direction. So integrating over the unit circle along a counter-clockwise curve is not the same as integrating along a clockwise curve. For a closed loop like this, what point we use as both the beginning and end of the curve doesn't matter, though.
If the curve $\gamma$ is counter-clockwise, like $\gamma_1 = e^{i t}, 0 \leq t \leq 2\pi$, then $\int_\gamma \frac{1}{z} dz = 2\pi i$. If the curve is clockwise, like $\gamma_2 = e^{-i t}, 0 \leq t \leq 2\pi$, then $\int_\gamma \frac{1}{z} dz = -2\pi i$.
We have
$$ \int_{\gamma_1} \frac{1}{z} dz = \int_{0}^{2\pi} \frac{\gamma'(t)}{\gamma(t)} dt = \int_0^{2\pi} \frac{i e^{it}}{e^{it}} dt = 2\pi i $$
The integrand is actually the constant $+i$, and does not change at the conjugate value $\bar z$.