Contour integration, Residue Theorem Evaluate the integral using contour integration
$$
\int_{0}^{\infty }\frac{dx}{1+x^a}
$$
I know how to solve the integral 
$$
\int_{0}^{\infty }\frac{dx}{1+x^{2a}}
$$
Using the residue theorem, however when I try to evaluate the first integral similar to the second integral the eventual residue sum
$$
2\pi i\sum res f(z)
$$
Breaks down because:
1) the 2 in 2pi*i doesn't cancel
2) the numerator in that must equal 2 in order to follow the Euler Sine formula, however the numerator in my solution equals 0, which causes the entire series to collapse to 0.
I'm using 
$$
z^a =(-1); roots = e^{\pi i/a}; 
$$
yet the summation breaks down.  I have a feeling it's a simple fix, but I'm not sure where it is since I'm still pretty rusty with contour integration.  Any help is appreciated.
 A: We can solve this for rational values of $a\ge 2$ and then extend it by continuity to real $a\ge 2.$ Let $$ a = \frac{p}{q}$$ with $(p, q)=1$ and $\frac{p}{q} \ge 2.$ Make the substitution $x = t^q$ (this is single-valued) in the integral to get
$$ \int_0^\infty \frac{1}{1+x^{p/q}} dx
=  \int_0^\infty \frac{q t^{q-1}}{1+t^p} dt
=  q \int_0^\infty \frac{t^{q-1}}{1+t^p} dt.$$
This last integral can be evaluated using a slice contour consisting of a line segment $\Gamma_1$ from $0$ to some $R$, with $R$ going to infinity, an arc $\Gamma_2$ going from $R$ to $R e^{2 i\pi/p}$ and another line segment $\Gamma_3$ back to the origin. Along $\Gamma_2$ the integrand is $O(1/R^{p-q+1})$ but $p\ge 2q$ so this is decreasing at least as fast as $O(1/R^2)$ because $p-q+1\ge q+1.$ Given that the length of $\Gamma_2$ is $R 2\pi/p$, this means that the integral along $\Gamma_2$ vanishes in the limit.
Setting $$f(z) = \frac{z^{q-1}}{1+z^p},$$ along $\Gamma_1$ we thus have, again in the limit,
$$\int_{\Gamma_1} f(z) dz = \int_0^\infty \frac{t^{q-1}}{1+t^p} dt $$
and along $\Gamma_3,$ parameterizing with $t = u e^{2\pi i/p}$
$$\int_{\Gamma_3} f(z) dz = 
\int_\infty^0 \frac{u^{q-1} e^{2\pi i(q-1)/p} }{1+u^p} e^{2\pi i/p} du
= -e^{2\pi i q/p} \int_0^\infty \frac{u^{q-1} }{1+u^p} du .$$ 
It follows that
$$ \left( 1 - e^{2\pi i q/p} \right) \int_0^\infty \frac{t^{q-1}}{1+t^p} dt
= 2\pi i \operatorname{Res}(f(z); z=e^{i\pi/p})$$
because $z_0=e^{i\pi/p}$ is the only pole inside the contour. The residue is
$$ \operatorname{Res}(f(z); z=e^{i\pi/p}) = 
\lim_{z\to z_0} \frac{z^{q-1}}{p z^{p-1}} =
\frac{1}{p} e^{(q-p)i\pi/p} = \frac{1}{p} e^{q i\pi/p -i\pi} =
- \frac{1}{p} e^{q i\pi/p}.$$
This yields
$$ q \int_0^\infty \frac{t^{q-1}}{1+t^p} dt =
- 2\pi i \frac{q}{p} \frac{e^{q i\pi/p}}{ 1 - e^{2\pi i q/p} }
= - 2\pi i \frac{q}{p} \frac{1}{e^{-q i\pi/p} - e^{q i\pi/p}} \\
= \pi \frac{q}{p} \frac{2i}{-e^{-q i\pi/p} + e^{q i\pi/p}}
= \pi \frac{q}{p} \frac{1}{\sin(\pi q/p)}.$$
Reverting back to real $a\ge 2$, we have shown that
$$\int_0^\infty \frac{1}{1+x^a} dx = \frac{\pi}{a\sin(\pi/a)}.$$
