TITLE: $P(z)$ defines a polynomial
QUESTION [6 upvotes]: Suppose that $f$ is analytic in a simply connected domain $D$ containing distinct points $z_1, z_2 ,\ldots,z_n $ and that $\gamma$ is simple closed curve  enclosing $z_1, z_2 ,\ldots,z_n $.
Set $w(z)= \prod_{k=1}^n (z-z_k)$ . Prove that 
$$P(z) =\int_{\gamma}  \frac {f(\zeta)}{w(\zeta)} \frac{w(\zeta)-w(z)}{\zeta-z}d\zeta$$ defines a polynomial of degree $n-1$ satisfying $P(z_k) =f(z_k), k =1,2,3,\ldots,n.$ 
I don't know what thought I am suppose to present here. What I just know is to do the partial fraction of the $w(z)$. Then I just stuck not knowing the fact I am using here. This is actually a recent comprehensive exam question which I could not solve. My professor gave me some hint but that also did not help. The idea of partial fraction came out of his mouth. But I don't remember what he told me to do to complete the problem. I really wish to see the detail solution of the problem. Thanks in advance.
Addendum
Partial Fraction of $\frac{1}{w(\zeta)}= \frac {1}{\prod _{k=1}^n (\zeta-z_k)}$ is given by
 $$\frac {A_1}{\zeta-z_1}+\frac {A_2}{\zeta-z_2}+\cdots+\frac {A_n}{\zeta-z_n}$$
Where each $A_i = \frac{1} {\prod_{j=1}^n z_i-z_j} , j \neq i$
Sorry I missed that not equal to part, I don't know how to accomodate that in the product, any edit appreciated.

REPLY [4 votes]: First note that $$ \frac{w(\zeta) - w(z)}{\zeta - z} $$ is in fact a polynomial in $(\zeta, w)$ and therefore does not have any poles as a function of $\zeta$ .  The only poles come from $w(\zeta)$ in the denominator and they are located at $z_1, \dotsc, z_n$.  If $z \not \in \{z_1, \dotsc, z_n \}$ an easy calculation shows that the residue at $z_k$ equals $$ \frac{f(z_k)}{w'(z_k)} \frac{w(z)}{z-z_k}.$$ This gives the relation
$$
P(z) = 2 \pi i \sum_{k=1}^n \frac{f(z_k)}{w'(z_k)} \frac{w(z)}{z-z_k}
$$
which is a polynomial of degree at most $n-1$ and therefore this equality extends to all $z$.  Use $$ \lim_{z \to z_k} \frac{w(z)}{z-z_k} = w'(z_k) $$ to quickly verify that $P(z_k) = 2 \pi i \, f(z_k)$.