I know how to prove that:
$$f(z)=\frac{1}{2\pi i}\oint_\gamma\frac{f(w)}{w-z}\,dw$$
Where $\gamma$ is a positive-oriented circle in some subset $U\subset\Bbb C$ such that $f$ is holomorphic on $U$ and continuous on $\overline{U}$.
The proof relies on:
$$\oint_\gamma\frac{1}{w-z}\,dw=2\pi i$$
When $z$ is the centre of $\gamma$.
However, what does one do when $z$ is not the centre of $\gamma$, or even when $\gamma$ is not a circle? We can't use the Cauchy Integral Theorem to show the two line integrals are equivalent, as $(w-z)^{-1}$ is not holomorphic, but the Cauchy Formula assumes that that line integral is always equal to $2\pi i$ anyway...
Why?
Note: I know little complex analysis, and am trying to understand the proofs of the Cauchy Integral formulae/theorems from first principles, so please don't involve the residue theorem in an answer as the residue theorem itself relies on the Cauchy Integral Formula (I think).