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.