$\renewcommand{\Re}{\operatorname{Re}} \renewcommand{\Im}{\operatorname{Im}}$
Not all examples should be covered.
For Information
THEOREM 1 (Cauchy's Theorem) Suppose that $f$ is analytic on a domain $D$. Let $\gamma$ be a piecewise smooth simple closed curve in $D$ whose inside $\Omega$ also lies in $D$. Then $$\int_\gamma f(z)\,dz = 0.$$
DEFINITION A domain $D$ is simply-connected if, whenever $\gamma$ is a simple closed curve in $D$, the inside of $\gamma$ is also a subset of $D$.
THEOREM 2 Let $D$ be a simply-connected domain and $\Gamma$ a closed curve in $D$ that is composed of a finite number of horizontal and vertical line segments. If $f$ is analytic in $D$, then $$ \int_\Gamma f(\zeta)\,d\zeta=0. $$
THEOREM 3 If $f$ is analytic in a simply-connected domain $D$, then there is an analytic function $F$ on $D$ with $F' = f$ throughout $D$.
COROLLARY Let $f$ be analytic on a simply-connected domain $D$, and let $\gamma$ be a piecewise smooth closed curve in $D$. Then $$\int_\gamma f(z)\,dz = 0.$$
THEOREM 4 (Cauchy's Formula) Suppose that $f$ is analytic on a domain $D$ and that $\gamma$ is a piecewise smooth, positively oriented simple closed curve in $D$ whose inside $\Omega$ also lies in $D$. Then $$ \int _\gamma \frac{f(\zeta)\, d\zeta}{\zeta -z}= \left\{\begin{aligned} & 2\pi if(z) && z\in \Omega,\\ &0 &&z\notin \Omega\cup\gamma. \end{aligned}\right. $$