Questions about $\int_{0}^{\infty} \frac{1}{x^\lambda (x + 4)} \, \mathrm{d}x$ Questions about
$$I = \int_{0}^{\infty} \frac{1}{x^\lambda (x + 4)} \, \mathrm{d}x = \pi4^{-\lambda}. $$
The exact solution can be found in Saff/Snider(p349) for $\lambda = 1/2$. I am using $\lambda$ because the next example $\int_{0}^{\infty} \frac{1}{x^\lambda (x - 4)} \, \mathrm{d}x$ has many steps similar to this. 
Here are my questions


*

*They used a branch cut on $(0,2\pi]$ which they called principal branch even though the book defines principal to mean $(-\pi,\pi].$ Why is it called principal for $(0,2\pi]$?

*For the pacman contour, here it where it got me. I know in the limiting as $\rho \to \infty, \epsilon \to 0$, the integral will coincide with the real integral, but to come up with this? When I look at the paceman contour, it feels like we are "deleting" the region of integration.

*These branch cuts are just chosen arbitrary to make our contours convenient right? So why can't I choose the semi-indented region? 

*I actually tried to use the contour above and found that on $x = -4$, I got
$$ \lim_{\delta \to 0} \int_{S_\delta} \frac{1}{-\sqrt{z}(z+4)} \, \mathrm{d}z = -\pi i \, \underset{z=-4}{\operatorname{Res}} = \frac{-\pi i}{\pm 2i} = - \frac{\pi}{2}$$
indicating there probably is an issue with my method. But I'd argue that since we are above the $y-$axis, we take $+2$ and hence $-\pi/2$.

*On $[-\delta - 4, -\epsilon]\cup [-\rho,-4-\delta]$, $\sqrt{x} := -\sqrt{x}$. But one of them go to zero and the other gives $\int_{-\infty}^{0} \frac{1}{-\sqrt{x}(x+4)} \, \mathrm{d}x$. Eventually I got to
$$2I - \frac{\pi}{2} = 0 \qquad \implies \qquad  I = \frac{\pi}{4} \neq \frac{\pi}{2} \stackrel{(\lambda = 1/2)}{=} \pi/4^{-\lambda} $$
which is "half" the answer (again reject $-2$ because we are on upper circle).

*I applied the same technique to the next example in the textbook $\int_{0}^{\infty} \frac{1}{x^\lambda (x - 4)} \, \mathrm{d}x  $ and yet again, I am missing the other half of the contour. If you are wondering why I keep cutting the negative axis $\{ x = 0, y < 0\}$, it is because I got the idea from $\int_{0}^{\infty} \frac{\log x}{x^2 + 1} \, \mathrm{d}x$
 A: 1. I am not sure either. As far as I know, the term 'principal logarithm' is usually saved for the complex logarithm with imaginary part restricted to $(-\pi, \pi]$.
2. The complex integral along the 'mouth' of the pacman will approximate your original integral.
(The beauty in this business is that the choice of branch cut will prevent the integral along both lips from cancelling each other.)
3-5. Of course the choice of contour is no more than trick. If we use the semi-circular contour with dents as illustrated in OP's figure, we end up with
$$ \mathrm{PV}\int_{0}^{\infty} \frac{1}{i\sqrt{x}(4-x)} \, \mathrm{d}x -\frac{\pi}{2} + \underbrace{ \int_{0}^{\infty} \frac{1}{\sqrt{x}(x+4)} \, \mathrm{d}x }_{=I} = 0. $$
Here, $\mathrm{PV}$ means that the integral is understood in Cauchy principal-value sense. Also notice that the integral coming from the negative real axis no longer equals $I$, and this is indeed one disadvantage of OP's contour compared with the pacman contour. 
Thankfully, in this case the PV integral is purely imaginary, and so, taking real parts of both sides proves that $I = \pi/2$ for $\lambda = 1/2$. Note that we no longer expect this luck when $\lambda \neq 1/2$. In such case, I would prefer to use pacman contour.
6. If $\lambda \in (0, 1)$ and the same computation is performed along the semicircular contour as in OP's figure, we end up with
$$ \mathrm{PV} \int_{0}^{\infty} \frac{\mathrm{d}x}{e^{i\pi \lambda} x^{\lambda}(4-x)} - \frac{\pi i}{e^{i\pi\lambda}4^{\lambda}} + \int_{0}^{\infty} \frac{\mathrm{d}x}{x^{\lambda}(x+4)} = 0. $$
As mentioned before, the PV integral no longer needs to be purely imaginary. So we need some extra step to extract an answer. By setting $J = \int_{0}^{\infty} \frac{\mathrm{d}x}{x^{\lambda}(4-x)}$, we know that both $I$ and $J$ are real and satisfies
$$ e^{-i\pi\lambda} J - e^{i\pi(\frac{1}{2}-\lambda)} \frac{\pi}{4^{\lambda}} + I = 0. $$
Comparing both the real and imaginary parts, we obtain the following system of linear equations
$$ \left\{ \begin{array}{rcl}
\cos(\pi\lambda) J - \sin(\pi\lambda) \frac{\pi}{4^{\lambda}} + I &=& 0, \\
-\sin(\pi\lambda) J - \cos(\pi\lambda) \frac{\pi}{4^{\lambda}} &=& 0.
\end{array} \right. $$
So it follows that
$$ J = -\frac{\pi}{4^{\lambda}} \cot(\pi\lambda), \qquad I = \frac{\pi}{4^{\lambda} \sin(\pi\lambda)}. $$
A: Easier with Gamma function
Letting $4y=x$, we have
$$
\begin{aligned}
\int_0^{\infty} \frac{1}{x^\lambda(x+4)} d x & =\int_0^{\infty} \frac{1}{(4 y)^\lambda(y+1)} d y \\
& =\frac{1}{4^\lambda} \int_0^{\infty} \frac{y^{-\lambda}}{y+1} d y \\
& =\frac{1}{4^\lambda} B(-\lambda+1, \lambda) \\
& =\frac{\pi}{4^\lambda \sin (\pi \lambda)} \quad \text { (By Reflection Property) }
\end{aligned}
$$
