Dogbone countor integral (evalutate $\int_0^1 \frac{x^n}{x^a(1-x)^{1-a}}dx$) I'm confronted with the following problem which I really don't seem to find a way to solve properly:
Let $n\in \mathbb{Z}$ be fixed. Determine for what values of the parameter $a\in\mathbb{C}$ the following integral converges, and then evaluate it.
$$\int_0^1 \frac{x^n}{x^a(1-x)^{1-a}}dx$$
It's quite easy to show that the constraint on $a$ for the function to be integrable on that interval is: $0<\text{Re}({a})<n+1$. But now I'm stuck with the evaluation part.
Since it is at the end of the chapter about exterior domains I'm assuming it should/can be solved using a dogbone contour integration... but I cannot find a nice way to evaluate the resiude at infinity of this particular function... and furthermore I cannot seem to find a nice value for the bottom slit, because I would expect something like a constant times my starting integral as it often occurs...
Can someone help me out?
Many thanks in advance
 A: I don't know if this can be done using residues.  It is the classic integral for the Beta function $B(a, n+1-a)$, so the answer is $\dfrac{\Gamma(a) \;\Gamma(n+1-a)}{\Gamma(n+1)}$.
EDIT: Ah!  If you transform the integral by $x = 1/t$, it becomes
$$ \int_1^\infty (t-1)^{a-1} t^{-1-n}\; dt $$
Now use $\oint_C (1-z)^{a-1} z^{-1-n}\; dz$ for a "C" contour

and note that the residue at $z=0$ is 
$$\dfrac{(-1)^n}{n!} \prod_{j=1}^{n} (a - j)$$
A: With these  types of integrals usually  what is being asked  for is to
use two  branches of  the logarithm whose  cuts cancel outside  of the
integration interval.
Suppose we seek to compute
$$Q_n = \int_0^1 \frac{x^n}{x^a (1-x)^{1-a}} dx.$$
Re-write this as
$$\int_0^1 z^n 
\exp(-a\mathrm{LogA}(z))
\exp(-(1-a)\mathrm{LogB}(1-z)) dz$$
and call the function $f(z).$
We  must choose  two  branches of  the  logarithm $\mathrm{LogA}$  and
$\mathrm{LogB}$ so that the cut is on the real axis from $0$ to $1.$
This is accomplished when $\mathrm{LogA}$  has the cut on the negative
real axis and $\mathrm{LogB}$ on the positive real axis.

Suppose  the  dogbone  contour  is  traversed  counterclockwise.  Then
$\mathrm{LogA}$  gives   the  real  value  just  above   the  cut  but
$\mathrm{LogB}$ contributes a factor  of $\exp(- 2\pi i (1-a)).$ Below
the  cut $\mathrm{LogA}$  again produces  the real  value but  so does
$\mathrm{LogB}.$ As there are no finite poles this implies that
$$Q_n (1 - \exp(2\pi i a))
= - 2\pi i \times \mathrm{Res}_{z=\infty} f(z).$$
Now for the residue at infinity we use the formula
$$\mathrm{Res}_{z=\infty} h(z)
= \mathrm{Res}_{z=0} 
\left[-\frac{1}{z^2} h\left(\frac{1}{z}\right)\right].$$
In  the following we  need to  distinguish between  the upper  and the
lower half-plane. Assume $z=R e^{i\theta}$ with $0\le\theta\lt2\pi.$
Upper half-plane.
Here we have $$\mathrm{LogA}(1/z) = - \mathrm{LogA}(z)$$
and $$\mathrm{LogB}(1-1/z) = 
\mathrm{LogB}(z-1) - \mathrm{LogB}(z).$$
This gives for the residue the term
$$- \frac{1}{z^{n+2}}
\exp(a\mathrm{LogA}(z))
\exp(-(1-a)\mathrm{LogB}(z-1))
\\ \times \exp((1-a)\mathrm{LogB}(z)).$$
But we have $$\exp(a\mathrm{LogA}(z))\exp((1-a)\mathrm{LogB}(z))
\\ = \exp(a(\log R+i\theta)+(1-a)(\log R+ i\theta)) = z,$$
so this becomes
$$- \frac{1}{z^{n+1}}
\exp(-(1-a)\mathrm{LogB}(z-1)).$$
Lower half-plane.
Here we have $$\mathrm{LogA}(1/z) = - \mathrm{LogA}(z)$$
and $$\mathrm{LogB}(1-1/z) = 2\pi i +
\mathrm{LogB}(z-1) - \mathrm{LogB}(z).$$
This gives for the residue the term
$$- \frac{1}{z^{n+2}}
\exp(-(1-a)2\pi i)
\exp(a\mathrm{LogA}(z))
\exp(-(1-a)\mathrm{LogB}(z-1))
\\ \times \exp((1-a)\mathrm{LogB}(z)).$$
But we have $$\exp(a\mathrm{LogA}(z))\exp((1-a)\mathrm{LogB}(z))
\\ = \exp(a(\log R-i(2\pi-\theta))+(1-a)(\log R+ i\theta)) = 
\exp(- a2\pi i) z,$$
so this becomes
$$- \frac{1}{z^{n+1}}
\exp(-(1-a)2\pi i)
\exp(-a 2\pi i)
\exp(-(1-a)\mathrm{LogB}(z-1))
\\ = - \frac{1}{z^{n+1}}
\exp(-(1-a)\mathrm{LogB}(z-1)).$$
We have  established matching terms for the upper and  the lower
half plane.
Note that we certainly have  analyticity of the exponential term in
a disk  of radius one round the  origin.  The cut begins  at $z=1$ and
extends away from the disk.

We now evaluate the residue for this branch.
Here we have that $$-\mathrm{LogB}(z-1) = \pi i
+ \mathrm{LogB}\frac{1}{1-z}$$ so we obtain
$$- \frac{1}{z^{n+1}}
\exp(-(1-a)\pi i)
\exp\left((1-a)\mathrm{LogB}\frac{1}{1-z}\right).$$
We can extract coefficients from  this either with the Newton binomial
or recognizing the mixed  generating function of the unsigned Stirling
numbers of the first kind. Using the latter we find that
$$n! [z^n] \exp\left(u\log\frac{1}{1-z}\right)
= u(u+1)\cdots(u+n-1).$$
This gives that 
$$ Q_n (1 - \exp(2\pi i a))
= \frac{2\pi i}{n!}\times 
\exp(-(1-a)\pi i) \times (1-a)(2-a)\cdots(n-a).$$
or
$$Q_n = \frac{2\pi i}{n!} \times \exp(-\pi i) \times
\frac{\exp(a\pi i)}{1 - \exp(2a\pi i)}
\times (1-a)(2-a)\cdots(n-a)
\\ =
- \frac{1}{n!} \times \pi \frac{2i}{\exp(-a\pi i) - \exp(a\pi i)}
\times (1-a)(2-a)\cdots(n-a)
\\ = \frac{1}{n!} \times \frac{\pi}{\sin(a\pi)} 
\times (1-a)(2-a)\cdots(n-a).$$

In order to be rigorous we also need to show continuity across the two
overlapping   cuts  on   $(-\infty,  0)$   as  shown   in   this  MSE
link.


Remark. It really helps to think of  the map from $z$ to $-z$ as a
$180$ degree  rotation when one  tries to visualize what  is happening
here.
