$P(z)$ defines a polynomial

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)$.


Let $$P_j(z) := \prod_{k=1}^j (z-z_j)$$ (Then $w(z)=P_n(z)$ by definition.) As you already mentioned it's a good idea to do partial fraction. We have

$$\begin{align}w(\xi)-w(z) &= ((\xi-z)+(z-z_n)) \cdot P_{n-1}(\xi) - (z-z_n) \cdot P_{n-1}(z) \\ &= (\xi-z) \cdot P_{n-1}(\xi) + (z-z_n) \cdot (P_{n-1}(\xi)-P_{n-1}(z)) \tag{1}\end{align}$$

hence

$$\frac{w(\xi)-w(z)}{\xi-z} = P_{n-1}(\xi) + \frac{z-z_n}{\xi-z} \cdot (P_{n-1}(\xi)-P_{n-1}(z)) \tag{2}$$

Now we do the same step as in (1) again and obtain

$$\begin{align}P_{n-1}(\xi)-P_{n-1}(z) &= (\xi-z) \cdot P_{n-2}(\xi) + (z-z_{n-1}) \cdot (P_{n-2}(\xi)-P_{n-2}(z)) \\ \stackrel{(2)}{\Rightarrow} \frac{w(\xi)-w(z)}{\xi-z} &= P_{n-1}(\xi) + \underbrace{(z-z_n)}_{=:Q_1(z)} \cdot P_{n-2}(\xi) + \frac{(z-z_n) \cdot (z-z_{n-1})}{\xi-z} \cdot (P_{n-2}(\xi)-P_{n-2}(z)) \end{align}$$

By induction we obtain

$$\frac{w(\xi)-w(z)}{\xi-z}= \sum_{j=1}^m Q_{j-1}(z) \cdot P_{n-j}(\xi) + \frac{Q_m(z)}{\xi-z} \cdot (P_{n-m}(\xi)-P_{n-m}(z))$$

where $Q_j(z) := \prod_{k=n-j}^n (z-z_j)$, $Q_0(z):=1$. This works fine for $m \leq n-2$. In the last step (where the remaining polynomial has degree 1), i.e. $m=n-1$, we obtain

$$\begin{align} \frac{w(\xi)-w(z)}{\xi-z}&= \sum_{j=1}^{n-1} Q_{j-1}(z) \cdot P_{n-j}(\xi) + \frac{Q_{n-1}(z)}{\xi-z} \cdot ((\xi-z_1)-(z-z_1)) \\ &= \sum_{j=1}^{n-1} Q_{j-1}(z) \cdot P_{n-j}(\xi) +Q_{n-1}(z) \tag{3} \end{align}$$

Now we are done: By using (3) in the definition of $P$ we obtain

$$\begin{align} P(z) &= \int_{\gamma} \frac{f(\xi)}{w(\xi)} \cdot \left( \sum_{j=1}^{n-1} Q_{j-1}(z) \cdot P_{n-j}(\xi) +Q_{n-1}(z) \right) \, d\xi \\ &= \sum_{j=1}^{n-1} Q_{j-1}(z) \cdot \underbrace{\int \frac{f(\xi)}{w(\xi)} \cdot P_{n-j}(\xi) \, d\xi}_{=:a_j} + Q_{n-1}(z) \cdot \underbrace{\int_{\gamma} \frac{f(\xi)}{w(\xi)} \, d\xi}_{=:b} \end{align}$$

Note that $Q_j$ are polynomials of degree $\leq n-1$ (and that the constants $a_j$, $b$ do not dependent on $z$). This shows that $P$ is polynomial of degree n-1.

Last but not least: $$P(z_k) = \int_{\gamma} \frac{f(\xi)}{w(\xi)} \cdot \frac{w(\xi)-0}{\xi-z_k} \, d\xi = \int_{\gamma}\frac{f(\xi)}{\xi-z_k} \, d\xi = 2\pi \imath \cdot f(z_k)$$ where we applied Cauchy's integral formula (and used $w(z_k)=0$). (So if you would like to have $P(z_k) = f(z_k)$ you should add the factor $\frac{1}{2\pi \imath} \cdots$ in your definiton of $P$.)