EDIT: The answer I gave in this thread is embarrassingly bad. I gave a much better answer in a much more recent thread that Alyosha has linked to in a comment to the original post.
$ $
You must be reading the same book as I am. And please share your approach.
The contour integration approach is to integrate $z^{p-q-1} \left(z-\frac{1}{z} \right)^{p+q-2}$ around the closed contour that consists of the right half of the circle $|z|=1$ and the vertical line segment from $i$ to $-i$.
There are branch points at $z=0,i$, and $-i$ when $p-q-1$ and $p+q-2$ are not integers. So define standard cuts and indent the contour at those points.
The conditions on the parameters will prevent the contour integral from blowing up in the limit (which I had some difficulty showing), particularly they prevent there from being a pole of order greater than 1 (or actually any pole at all) at the origin when $p-q-1$ and $p+q-2$ are integers.
And apparently after evaluation you can argue that the restrictions on the parameters can be loosened.