The only way to learn mathematics is to do mathematics, Paul Halmos

A complex function $f(z)$ maps $z = x + iy \in \mathbb{C}$ to another complex number. For example: $f(z) = z^2 = (x + iy)^2 = x^2 - y^2 + 2ixy, f(z) = \frac{1}{z}, f(z) = \sqrt{z^2 + 7}$.
A contour is a continuous, piecewise-smooth curve defined parametrically as: $z(t) = x(t) + iy(t), \quad a \leq t \leq b$.
Definition (Smooth Contour Integral). Let ᵞ be a smooth contour (a continuously differentiable path in the complex plane), $\gamma: [a, b] \to \mathbb{C}$. Let $f: \gamma^* \to \mathbb{C}$ be a continuous complex-valued function defined on the trace $\gamma^*$ of the contour (i.e. along the image of $\gamma$). Then, the contour integral of f along $\gamma$ is defined as $\int_{\gamma} f(z)dz := \int_{a}^{b} f(\gamma(t)) \gamma^{'}(t)dt$.

Deformation of Contours. If two contours $\gamma_1$ and $\gamma_2 $ are homotopic (i.e., one can be continuously deformed into the other without crossing any singularities of f) in a domain where f(z) is analytic, then: $\int_{\gamma_1} f(z)dz = \int_{\gamma_2} f(z)dz.$
Fundamental Theorem of Calculus for Contours. Suppose $\gamma$ is a contour (piecewise smooth path) from a to b, f is defined on a domain D containing $\gamma^*$ (the image of $\gamma$) and admits a primitive (antiderivative) F on D (i.e., $F'(z) = f(z)$), then $\int_{\gamma} f(z)dz = F(\gamma(b)) - F(\gamma(a))$. In particular, if $\gamma$ is a closed contour (i.e., $\gamma(a)=\gamma(b)$), this integral evaluates to zero, $\int_{\gamma} f(z)dz = 0.$
Estimation Theorem or the Triangle Inequality for Integrals. The triangle inequality for integrals in complex analysis states thatfor any continuous complex function $f:[a,b] \to \mathbb{C}$ on a closed real interval [a,b] (f(t) = u(t) + iv(t), t a real parameter), the following holds: $∣\int_a^b f(t)dt| \leq \int_a^b |f(t)|dt$.
Estimation Lemma (ML Inequality) for contour integrals. For any continuous complex function $f:[a,b] \to \mathbb{C}$ on a closed real interval [a,b] (f(z) = u(x, y) + iv(x, y)) with f bounded by some constant M along the entire contour, |f(z)| ≤ M for all $z \in \gamma^*$ (the image/trace of the contour in the complex plane), the following holds: $∣\int_\gamma f(z)dz| \leq M \cdot l(\gamma)$ where l(γ) is the arc length of the contour γ given by $\int_a^b |\gamma^{'}(t)|dt = \int_a^b \sqrt{x'(t)^2 + y'(t)^2} \text{ where } \gamma(t) = x(t) + iy(t)$.
Jordan’s curve theorem. Any simple closed curve (a continuous loop in the plane that does not intersect itself) separates the plane into two disjoint connected regions: one interior (bounded) and one exterior (unbounded). The curve itself is the boundary of both regions. In other words, it partitions the plane into exactly three disjoint sets:
Cauchy’s theorem (Classical “Green’s theorem” version). Let $\Omega \subset \mathbb{C}$ be an open domain. Suppose f = u + iv is analytic in $\Omega$ and its partial derivatives ( $u_x,u_y,v_x,v_y$) are continuous in $\Omega$. If $\gamma$ is a positively oriented, piecewise-smooth $C^1$, simple closed contour with $\gamma^* \cup \operatorname{Int}(\gamma) \subset \Omega$ (its path and interior both lie inside Ω), then $\oint_{\gamma} f(z)dz = 0.$
Cauchy’s Theorem (Cauchy–Goursat). This is the more powerful version, as it removes the need for continuous partial derivatives. If f is analytic in an open set containing a simple closed contour γ and its interior $\gamma^*\cup\operatorname{Int}(\gamma)$, then $\oint_{\gamma} f(z)dz = 0$.
Cauchy’s Theorem for simply connected domains. If a function f is analytic (a function that is complex-differentiable at every point within a domain, i.e., well-behaved and smooth, with no sharp corners, breaks, or singularities like division by zero) throughout a simply simple connected domain D then $\oint_C f(z)dz = 0$ for every closed contour C lying in D.
Cauchy’s Theorem for a Multiply Connected Domain. Let C be a positively oriented (counterclockwise) simple closed contour. Let $C_1, C_2, \cdots, C_n$ be positively oriented simple closed contours lying strictly inside C with pairwise disjoint interiors (they don’t overlap and no contour is inside another). Let $R$ be the multiply connected region (with n holes) inside $C$ but outside of every $C_k$ (each $C_k$ surrounds only one hole in the domain), $R = Int(C) \setminus \bigcup_{k=1}^n \overline{Int(C_k)}$. If f(z) is analytic on an open set containing $\overline{R}$ (hence analytic on each boundary component $C, C_1, \ldots, C_n$), then: $\oint_C f(z)dz = \sum_{k=1}^n \oint_{C_k} f(z)dz$ where all contours ($C$ and every $C_k$) are traversed in the same direction (e.g., all counter-clockwise).
The integral over the outer boundary is equal to the sum of the integrals over the inner boundaries (the holes).
Proof:
The idea is to transform the multiply connected region $R$ into a simply connected region (Figure ii).

Imagine our region $R$ as a piece of paper with $n$ holes punched through it. A loop within this region cannot be contracted to a point if it surrounds a hole. To resolve this, we create a series of “cuts” or “bridges.” We will choose $n$ pairwise disjoint polygonal arcs (cuts), $L_k$, each one connecting the outer contour $C$ to one of the inner contours $C_k$. The arcs lie entirely in R except at their endpoints. The arcs are mutually disjoint and do not meet any boundary except at their endpoints.
Now, consider the region $R'$ formed by “cutting” $R$ along these lines, $R' = R \setminus \bigcup_{k=1}^n L_k$ This new region is simply connected. Why is that? Because any loop you could possibly draw in it can be shrunk to a point. If a loop attempts to encircle a hole, the “cut” prevents this by forcing it back, ensuring it cannot actually loop around the hole.
In other words, any loop that tries to wind around a hole is forced to cross its cut and thus cannot remain in R′.
Now that we have a simply connected region R’, let’s trace its entire boundary. We will create one single, continuous, non-intersecting (simple) contour, which we’ll call $\Gamma$.
Let’s trace $\Gamma$ so that the region $R'$ is always on our left side (“positive” orientation). Here is the path of $\Gamma$:
The resulting Γ is a single simple closed contour (the boundary of the simply connected region R′).
Our new region R’ is simply connected. Our function f(z) is analytic everywhere inside and on the boundary of R’ (since we only cut through $R$, where $f(z)$ was already analytic). Our new contour $\Gamma$ is the boundary of R’. By the standard Cauchy-Goursat theorem (for simple contours), the integral of $f(z)$ over this entire path $\Gamma$ must be zero: $\oint_{\Gamma} f(z)dz = 0$
Now, let’s write out what $\oint_{\Gamma} f(z)dz$ actually is. It’s the sum of all the pieces we traveled:
$$ \begin{aligned} \oint_{\Gamma} f(z)dz &=\oint_C f(z)dz \text{( The outer loop, CCW )} \\[2pt] &+\sum_{k=1}^n\Bigl(\int_{L_k} f(z)dz \text{ [The cut "in"] } + \oint_{C_k'} f(z)dz \text{ [The inner loop, clockwise] } + \int_{-L_k} f(z)dz \text{ [The cut "out"] } \Bigr). \end{aligned} $$A fundamental property of contour integrals is that reversing the path negates the value, $\int_{-L_k} f(z)dz = - \int_{L_k} f(z)dz$, so each cut contributes zero. Hence, $0 = \oint_{\Gamma} f(z)dz = \oint_C f(z)dz + \sum_{k=1}^n\oint_{C_k'} f(z)dz \text{ clockwise}$
So, we have: $\oint_C f(z)dz + \sum_{k=1}^n \oint_{C_k'} f(z)dz = 0$ where $C$ is counter-clockwise (CCW) and all the $C_k'$ are clockwise (CW).
Let $C_k$ (without the prime) be the counter-clockwise (CCW) path around the $k$-th hole. By the path-reversal rule, $\oint_{C_k'} f(z)dz = - \oint_{C_k} f(z)dz$.
Now, substitute this into our previous equation: $\oint_C f(z)dz + \sum_{k=1}^n \left( - \oint_{C_k} f(z)dz \right) = 0$
Or alternatively,
$\oint_C f(z)dz = \sum_{k=1}^n \oint_{C_k} f(z)dz$

For each inner boundary $C_k$, let: $p_k$ be the endpoint of $L_k$ on $C_k$, $q_k$ be the endpoint of $L_{k+1}$ on $C_k$. Decompose $C_k$ (with clockwise orientation) into two subarcs: (i) $A_k$. the CW arc on $C_k$ from $p_k$ to $q_k$ (traversed on the forward pass); $B_k$, the CW complementary arc from $q_k$ back to $p_k$ (traversed on the return pass). Similarly, C (with CCW orientation) is split by the endpoints of $L_1$ and $L_{n+1}$ into two CCW arcs:
Boundary $\Gamma=\partial R'$ with region on the left:
This produces a single “stitch” that opens every hole. The boundary $\Gamma$ of the resulting simply connected region consists of C, each $C_k$ (clockwise), and the cuts $L_j$ (each used once forward and once backward). The same cancellation of the cut integrals yields exactly the same identity.
You don’t traverse each $C_k$ entirely on the forward pass. You take the CW subarc $A_k$ from where you enter $C_k$ via $L_k$ to where you leave it via $L_{k+1}$, and you finish the complementary CW subarc $B_k$ on the way back.
TL;DR. On the forward pass you traverse only the first half $A_k$ of each inner boundary (CW), then on the return pass you traverse the second half $B_k$ (also CW). Together they make the full clockwise loop $C_k$. All cut integrals cancel pairwise.

Solution: The function is not analytic where the denominator is zero, so we have two simple poles at z = 0 and z = 1. $C$ is a simple closed contour (positively oriented) that encloses both singularities. The region $R$ inside $C$ but outside the singularities is a multiply connected domain (a region with two “holes”).
To apply this theorem, we can take small clockwise circles $C_1$ and $C_2$ around the points 0 and 1. This theorem states that the integral over the outer boundary C is equal to the sum of the integrals over the inner boundaries $C_1$ and $C_2$. We use partial fractions to simplify the integrand: $\frac{1}{z(z-1)} = \frac{1}{z-1} - \frac{1}{z}$.
Thus,
$$ \begin{aligned} \oint_C \frac{dz}{z(z-1)} &=[\text{The Cauchy Theorem for Multiply Connected Domains}] \\[2pt] &=\oint_{C_1} \frac{dz}{z(z-1)} + \oint_{C_2} \frac{dz}{z(z-1)} \\[2pt] &=\oint_{C_1}\frac{dz}{z-1} - \oint_{C_1}\frac{dz}{z} + \oint_{C_2}\frac{dz}{z-1} - \oint_{C_2}\frac{dz}{z}\\[2pt] &=0 - 2\pi i + 2\pi i - 0\\[2pt] &=0. \end{aligned} $$$\oint_{C_1}\frac{dz}{z-1} = \oint_{C_2}\frac{dz}{z} = 0$ because we are integrating around $C_1$ and $C_2$, the circles around z = 0 and z = 1, respectively. The functions $\frac{dz}{z-1}$ and $\frac{dz}{z}$ are analytic everywhere inside $C_1$ and $C_2$ respectively, since their only singularities are at z = 1 and z = 0 respectively, which are obviously (they were chosen small circles) outside $C_1$ and $C_2$. By the Cauchy-Goursat Theorem, the integral of an analytic function over a simple closed contour is 0.
$\oint_{C_1}\frac{dz}{z} = 2\pi i$. We are integrating around $C_1$, which encloses the singularity at $z=0$. By the Cauchy Integral Formula (with $f(z)=1$ and $a=0$), this integral is $\oint_{C_1} \frac{dz}{z-0} = 2\pi i \cdot f(0) = 2\pi i \cdot 1 = \mathbf{2\pi i}$. Similarly, by the Cauchy Integral Formula with f(z) = 1 and $a=1, \oint_{C_2} \frac{dz}{z-1} = 2\pi i \cdot f(1) = 2\pi i \cdot 1 = \mathbf{2\pi i}$.

Solution: The function is not analytic where the denominator is zero, z²+1 = (z - i)(z + i) so we have two simple poles z = i and z = -i. C is a simple closed contour (positively oriented) that encloses both singularities. The region R inside C but outside the singularities is a multiply connected domain (a region with two “holes”).
To apply this theorem, we can take small clockwise circles $C_1$ and $C_2$ around the points i and -i. This theorem states that the integral over the outer boundary C is equal to the sum of the integrals over the inner boundaries $C_1$ and $C_2$. We use partial fractions to simplify the integrand: $\frac{1}{z²+1} = \frac{1}{2i}(\frac{1}{z-i}) - \frac{1}{2i}(\frac{1}{z+i})$.
Thus,
$$ \begin{aligned} \oint_C \frac{dz}{z²+1} &=[\text{The Cauchy Theorem for Multiply Connected Domains}] \\[2pt] &=\oint_{C_1} \frac{dz}{z²+1} + \oint_{C_2} \frac{dz}{z²+1} \\[2pt] &=\frac{1}{2i}\oint_{C_1}\frac{1}{z-i } - \frac{1}{2i}\oint_{C_1}\frac{1}{z+i} + \frac{1}{2i}\oint_{C_2}\frac{1}{z-i} - \frac{1}{2i}\oint_{C_2}\frac{1}{z+i}\\[2pt] &=\frac{1}{2i}(2\pi i) - 0 + 0 - \frac{1}{2i}(2\pi i)\\[2pt] &=\pi - \pi = 0. \end{aligned} $$General Cauchy Theorem for Multiply Connected Domains. Let $R$ be the multiply connected region (with n holes) inside $C$ but outside of every $C_k$ (each $C_k$ surrounds only one hole in the domain), $R = Int(C) \setminus \bigcup_{k=1}^n \overline{Int(C_k)}$, and let $f(z)$ be analytic on $R$. Now, let $\Gamma$ be any general closed contour (not necessarily simple) that lies entirely in R. This $\Gamma$ can wind around the “holes” (the regions inside each $C_k$) in any way it likes (this is the winding number or index of $\Gamma$ around each hole), the integral over $\Gamma$ is: $\oint_{\Gamma} f(z)dz = \sum_{k=1}^n m_k \oint_{C_k} f(z)dz$.
Definition. Let $a_k$ be any point inside the $k$-th hole (the region bounded by $C_k$). The winding number or index of $\Gamma$ around $a_k$ is the total number of counterclockwise turns that the object makes around $a_k$, $m_k = \text{Ind}_{\Gamma}(a_k) = \frac{1}{2\pi i} \oint_{\Gamma} \frac{dz}{z-a_k}$.
$m_k = 1$ means $\Gamma$ loops once counter-clockwise around the $k$-th hole and $m_k = -1$ means $\Gamma$ loops once clockwise around the $k$-th hole. Similarly, $m_k = 2$ means $\Gamma$ loops twice counter-clockwise. $m_k = 0$ means $\Gamma$ does not enclose the $k$-th hole at all.
Proof
This theorem is a direct consequence of the Deformation Principle. This means we can freely “deform” the contour $\Gamma$ anywhere within R without changing the value of the integral $\oint_{\Gamma} f(z)dz$. We can stretch it, shrink it, and move it, as long as we don’t cross any of the “holes” (the regions $Int(C_k)$) or the outer boundary $C$.
Besides, as we have previously demonstrated, any general contour $\Gamma$ in $R$ can be continuously deformed within $R$ into a new path that is just a combination of the inner boundary contours $C_k$.
How does the deformation work?
If $\Gamma$ loops $m_1$ times around the $C_1$ hole, $m_2$ times around $C_2$, and so on, we can deform $\Gamma$ (using the “cut” logic from the previous proof) so that it becomes a path that literally traces:
$C_1$, $m_1$ times. $C_2$, $m_2$ times. … $C_n$, $m_n$ times. The integrals over the “bridges” or “cuts” used to do this deformation all cancel out, just as they did in the previous proof. Since the integral is unchanged by this deformation, the integral over the original Γ must be equal to the integral over this new, “simplified” path:
$\oint_{\Gamma} f(z)dz = \int_{m_1 C_1 + m_2 C_2 + \cdots + m_n C_n} f(z)dz$
By the linearity of integrals, this is:
$\oint_{\Gamma} f(z)dz = m_1 \oint_{C_1} f(z)dz + m_2 \oint_{C_2} f(z)dz + \cdots + m_n \oint_{C_n} f(z)dz$
This is precisely the theorem:
$\oint_{\Gamma} f(z)dz = \sum_{k=1}^n m_k \oint_{C_k} f(z)dz$