Evaluate $\int_0^1 \frac{x^{u-1} (1-x)^{-u}}{a^2 x^2+2 a x \cos (t)+1} \, dx$ Gradshteyn&Ryzhik $3.261.4$ states that：
$$\int_0^1 \frac{x^{u-1} (1-x)^{-u}}{a^2 x^2+2 a x \cos (t)+1} \, dx=\frac{\pi  \csc (t) \csc (\pi  u) \sin \left(t-u \tan ^{-1}\left(\frac{a \sin (t)}{a \cos (t)+1}\right)\right)}{\left(a^2+2 a \cos (t)+1\right)^{u/2}}$$
At first glance contour integration encircling segment $[0,1]$ seems promising but the residue calculus is a bit complicated. Are there any simpler methods?
 A: For $z\in\mathbb{C}$, $|z|<1$, $0<u<1$, we have (a known "hypergeometric" representation)
$$I(z):=\int_0^1\frac{x^{u-1}(1-x)^{-u}}{1+zx}\,dx=\sum_{n=0}^{\infty}(-z)^n\mathrm{B}(n+u,1-u)\\=\frac{\pi}{\sin u\pi}\sum_{n=0}^{\infty}\binom{u+n-1}{n}(-z)^n=\frac{\pi}{\sin u\pi}(1+z)^{-u}$$
(with the principal branch of $(\cdot)^{-u}$). Your integral is equal to $\dfrac{e^{it}I(ae^{it})-e^{-it}I(ae^{-it})}{2i\sin t}$.
A: An alternative way to show that $$\int_{0}^{1} \frac{x^{u-1}(1-x)^{-u}}{1+zx} \, \mathrm dx \, = \frac{\pi}{ \sin (\pi u)} \, (1+z)^{-u} \, , \quad 0<u <1 \, , $$ where $z$ is not a real number less than or equal to $-1$, is to first make the transformation $x= \frac{1}{1+t}$ and then integrate around a keyhole contour.
$$ \begin{align} \int_{0}^{1} \frac{x^{u-1}(1-x)^{-u}}{1+zx} \, \mathrm dx &= \int_{0}^{\infty} \frac{t^{-u}}{t+z+1} \, \mathrm dt \\ &= \frac{2 \pi i}{1-e^{-2 \pi i u}} \, \text{Res}_{s=-z-1} \frac{s^{-u}}{s+z+1} \\ &= \frac{2 \pi i}{1-e^{-2 \pi i u}} \, (-z-1)^{-u} \\ &= \frac{2 \pi i \, e^{- \pi iu} }{1-e^{-2 \pi iu}} \, (z+1)^{-u} \\ &= \frac{\pi}{ \sin(\pi u)} \, (z+1)^{-u} \end{align}$$
