is holomorphic everywhere except its poles. And the contour doesn't have any singularities / poles on it.

Now, think of the Laurent Series of f(z) on the point a.

Integrate both sides by the contour ,

Cauchy's integral theorem tell us that for any n except -1.

So it means all integrals except the red one will vanish (because they are 0).

Now we have,

Let be a circle of radius 1 with center in the complex plane.

This will give,

The -1st coefficient of Laurent Series of f(z) at a point is called the Residue of that function at that point.

So we can generalize this for contours with multiple poles,