We know the contour integral of f(z) is 0. Consider the contour integral of f(z)/z. Since the contour is closed and bounded, it cannot approach 0 without actually touching 0. So there is some disk of radius r about 0, completely inside the contour.
Since f(z)/z is analytic between these two closed curves, apply the Cauchy Goursat theorem, and the integral of f around our original closed curve is equal to the integral of f around the circle of radius r.
Remember that f is continuous at 0, so for small r, f is arbitrarily close to w. We need to find the contour integral of w/z, at radius r.
Use the path cos(t)r,sin(t)ir. By Demoivre's formula, 1/z = cos(t)/r,-sin(t)i/r. Multiply this by the direction vector of the path and get 0+i. Integrate as t runs from 0 to 2π and get 2πi. Therefore the integral around the tiny circle of radius r, and the integral around our original path, is f(0)×2πi.
If z0 is an arbitrary point inside the contour, we can make a similar claim for the contour integral of f(z)/(z-z0). The result is f(z0)×2πi. This is the Cauchy integral formula.