The integral of $f$ along a contour is built like a work integral: chop the curve into small pieces, multiply the value of $f$ by the small step $dz$, and add. Parametrizing turns it into an ordinary integral in $t$.
Key idea
$$\int_C f(z)\,dz = \int_a^b f\big(z(t)\big)\,z'(t)\,dt.$$
The answer does not depend on how $C$ is parametrized, only on the curve and its direction; reversing the direction changes the sign. The most important single integral: for any circle $C$ centered at $a$, traced once counterclockwise,
$$\oint_C \frac{dz}{z - a} = 2\pi i, \qquad \oint_C (z - a)^n\,dz = 0 \quad (n \ne -1).$$
Why it works
$dz = z'(t)\,dt$ is the small step along the curve, just as $d\mathbf{r} = \mathbf{r}'(t)\,dt$ in a line integral; a change of parameter rescales $dt$ and $z'(t)$ in opposite ways, which is why the parametrization does not matter. For the key integral, put $z = a + re^{it}$: then $(z - a)^n z'(t) = r^ne^{int} \cdot ire^{it} = ir^{n + 1}e^{i(n + 1)t}$. If $n = -1$ this is the constant $i$, and integrating over $[0, 2\pi]$ gives $2\pi i$. Otherwise $\int_0^{2\pi} e^{i(n + 1)t}\,dt = 0$, since cosine and sine integrate to $0$ over whole periods.
Worked examples
Worked example: A segment
Compute $\displaystyle\int_C z^2\,dz$ along the segment from $0$ to $1 + i$.
- $z(t) = (1 + i)t$, $z'(t) = 1 + i$, $0 \le t \le 1$.
- $\int_0^1 (1 + i)^2t^2(1 + i)\,dt = (1 + i)^3\int_0^1 t^2\,dt = \frac{(1 + i)^3}{3}$.
- $(1 + i)^3 = (1 + i)(2i) = -2 + 2i$, so the integral is $-\frac{2}{3} + \frac{2}{3}i$.
Answer: $-\frac{2}{3} + \frac{2}{3}i$
Worked example: The conjugate around a circle
Compute $\displaystyle\oint_{|z| = 2} \overline{z}\,dz$.
- $z = 2e^{it}$, $\overline{z} = 2e^{-it}$, $dz = 2ie^{it}\,dt$.
- The integrand is $2e^{-it} \cdot 2ie^{it} = 4i$.
- $\int_0^{2\pi} 4i\,dt = 8\pi i$. (In general $\oint_{|z| = r}\overline{z}\,dz = 2\pi ir^2$, not $0$.)
Answer: $8\pi i$
Worked example: Half of a circle
Compute $\displaystyle\int_C \frac{dz}{z}$ along the upper half of $|z| = 1$ from $1$ to $-1$.
- $z = e^{it}$ for $0 \le t \le \pi$; $\frac{z'(t)}{z(t)} = \frac{ie^{it}}{e^{it}} = i$.
- $\int_0^\pi i\,dt = \pi i$. The lower half from $1$ to $-1$ gives $-\pi i$: the integral depends on the path.
Answer: $\pi i$
- Parametrize: $z(t)$ for $a \le t \le b$, in the right direction; compute $z'(t)$.
- Substitute: $f(z(t))\,z'(t)$ is an ordinary complex-valued function of $t$.
- Integrate the real and imaginary parts (or integrate $e^{ikt}$ directly).
- For a path made of pieces, add the integrals of the pieces.
Contour integrals are linear ($\int_C (af + bg)\,dz = a\int_C f\,dz + b\int_C g\,dz$) and add over pieces of a path, exactly like line integrals.
Common mistake
Leaving out $z'(t)$. Writing $\int f(z(t))\,dt$ treats the integral as an average over the parameter, not a sum of $f\,dz$. For $\oint_{|z| = 1}\frac{dz}{z}$ it gives $\int_0^{2\pi} e^{-it}\,dt = 0$ instead of $2\pi i$. Quick check: the integral of the constant $1$ over a segment from $z_1$ to $z_2$ must be $z_2 - z_1$; that only comes out right with the factor $z'(t)$.