In Orthogonal Polynomials (4th ed., Amer. Math. Soc. Colloq. Publ., vol. 23, 1975), Szegő starts off section 4.4 by giving the following integral representation of the Jacobi polynomials:
$$P_n^{(\alpha,\beta)}(x) = \dfrac{1}{2\pi i}\int\left(1+\dfrac{x+1}{2}z\right)^{n+\alpha} \left(1+\dfrac{x-1}{2}z\right)^{n+\beta} z^{-n-1}\,\mathrm{d}z.$$
$``$[Here] we assume that $x\neq\pm 1.$ The integration is extended in the positive sense along a closed curve around the origin, such that the points $-2(x\pm 1)^{-1}$ lie neither on it nor in its interior. (We define the first and second factors of the integrand to be $1$ for $z=0$.) Hence for sufficiently small values of $\vert w\vert$,
$$\sum_{n=0}^{\infty}P_n^{(\alpha,\beta)}(x)w^n = \dfrac{1}{2\pi i}\int\frac{\left(1+\dfrac{x+1}{2}z\right)^{\alpha} \left(1+\dfrac{x-1}{2}z\right)^{\beta}}{z-w\left(1+\dfrac{x+1}{2}z\right)\left(1+\dfrac{x-1}{2}z\right)}\,\mathrm{d}z.”$$
He then simplifies the latter contour integral and uses Cauchy's integral formula to show that it equals the well-known, closed form of the Jacobi polynomials' generating function. Unfortunately, I don't understand how he arrived at the second integral from the first one to begin with. Any help would be appreciated.