$\int_{0}^{\infty} \frac{1}{1 + x^r}\:dx = \frac{1}{r}\Gamma\left( \frac{r - 1}{r}\right)\Gamma\left( \frac{1}{r}\right)$ [duplicate]

Your given integral is closely related to the Mellin transform and can be evaluated by using Ramanujan's Master Theorem.

Ramanujan's Master Theorem

Let $f(x)$ be an analytic function with a MacLaurin Expansion of the form $$f(x)=\sum_{k=0}^{\infty}\frac{\phi(k)}{k!}(-x)^k$$then the Mellin Transform of this function is given by $$\int_0^{\infty}x^{s-1}f(x)dx=\Gamma(s)\phi(-s)$$

In order to get there we can expand the fraction as a geometric series

$$\begin{align} I=\int_0^{\infty}\frac1{1+x^n}dx&=\int_0^{\infty}\sum_{k=0}^{\infty}(-1)^k x^{kn}dx \end{align}$$

Now by applying the substitution $t=x^n$ followed by a little bit of reshaping yields to

$$\begin{align} I&=\int_0^{\infty}\sum_{k=0}^{\infty}(-1)^k x^{kn}dx\\ &=\frac1n\int_0^{\infty}t^{1/n-1}\sum_{k=0}^{\infty}(-1)^k\frac{k!}{k!}t^{k}dt\\ &=\frac1n\int_0^{\infty}t^{1/n-1}\sum_{k=0}^{\infty}(-1)^k\frac{\phi(k)}{k!}t^{k}dt \end{align}$$

Now we can apply Ramanujan's Master Theorem with $s=1/n$ and $\phi(k)=\Gamma(k+1)$ to get

$$\begin{align} I=\frac1n\int_0^{\infty}t^{1/n-1}\sum_{k=0}^{\infty}(-1)^k\frac{\phi(k)}{k!}t^{k}dt&=\frac1n\Gamma\left(\frac1n\right)\Gamma\left(1-\frac1n\right) \end{align}$$

And finally this can be simplified, as already pointed out, by using Euler's Reflection Formula $($as long as it holds i.e. for all $1/n\notin\mathbb Z$$)$ to get

$$I=\int_0^{\infty}\frac1{1+x^n}dx=\frac1n\frac{\pi}{\sin\left(\frac{\pi}{n}\right)}$$


NOT A FULL SOLUTION:

I've been working with special cases of the integral.

Here we will consider $r = 2m$ where $m \in \mathbb{N}$. In doing so, we observe that the roots of the denominator are $m$ pairs of complex roots $(z, c(z))$ where $c(z)$ is the conjugate of $z$. To verify this:

\begin{align} x^{2m} + 1 = 0 \rightarrow x^{2m} = e^{\pi i} \end{align}

By De Moivre's formula, we observe that:

\begin{align} x = \exp\left({\frac{\pi + 2\pi j}{2m} i} \right) \mbox{ for } j = 0\dots 2m - 1 \end{align}

Which we can express as the set

\begin{align} S &= \Bigg\{ \exp\left({\frac{\pi + 2\pi \cdot 0}{2m} i} \right) , \:\exp\left({\frac{\pi + 2\pi \cdot 1}{2m} i} \right),\dots,\:\exp\left({\frac{\pi + 2\pi \cdot (2m - 2)}{2m} i} \right)\\ &\qquad\:\exp\left({\frac{\pi + 2\pi \cdot (2m - 1)}{2m} i} \right)\Bigg\} \\ \end{align}

Which can be expressed as the set of 2-tuples

\begin{align} S &= \left\{ \left( \exp\left({\frac{\pi + 2\pi j}{2m} i} \right) , \:\exp\left({\frac{\pi + 2\pi(2m - 1 - j )}{2m} i} \right)\right)\: \bigg|\: j = 0 \dots m - 1\right\}\\ & = \left\{ (z_j, c\left(z_j\right)\:|\: j = 0 \dots m - 1 \right\} \end{align}

From here, we can factor $x^{2m} + 1$ into the form

\begin{align} x^{2m} + 1 &= \prod_{r \in S} \left(x + r_j\right)\left(x + c(r_j)\right) \\ &= \prod_{r \in S} \left(x^2 + \left(r_j + c(r_j)\right)x + r_j c(r_j)\right) \\ &= \prod_{r \in S} \left(x^2 + 2\Re\left(r_j\right)x + \left|r_j \right|^2\right) \end{align}

For our case here $\left|r_j \right|^2 = 1$ and $\Re\left(r_j\right) = \cos\left({\frac{\pi + 2\pi j}{2m} } \right)$. Hence,

\begin{align} \frac{1}{x^{2m} + 1} = \prod_{j = 0}^{m - 1}\frac{1}{ x^2 + 2\cos\left({\frac{\pi + 2\pi j}{2m} } \right)x + 1} \end{align}

From here, to evaluate the integral we must employ Partial Fraction Decomposition:

\begin{align} \frac{1}{x^{2m} + 1} = \prod_{j = 0}^{m - 1}\frac{1}{ x^2 + 2\cos\left({\frac{\pi + 2\pi j}{2m} } \right)x + 1} = \sum_{j = 0}^{m - 1}\frac{\alpha_j + \beta_jx}{ x^2 + 2\cos\left({\frac{\pi + 2\pi j}{2m} } \right)x + 1} \end{align}

And solve for $\alpha_j$ and $\beta_j$. Putting the coefficents to the side we can find general expressions for the integral:

\begin{align} \frac{1}{x^{2m} + 1} = \prod_{j = 0}^{m - 1}\frac{1}{ x^2 + 2\cos\left({\frac{\pi + 2\pi j}{2m} } \right)x + 1} \end{align}

From here, to evaluate the integral we must employ Partial Fraction Decomposition:

\begin{align} \int_{0}^{\infty}\frac{1}{x^{2m} + 1}\:dx &= \int_{0}^{\infty}\sum_{j = 0}^{m - 1}\frac{\alpha_j + \beta_jx}{ x^2 + 2\cos\left({\frac{\pi + 2\pi j}{2m} } \right)x + 1}\:dx \\ &= \sum_{j = 0}^{m - 1}\left[ \int_{0}^{\infty}\frac{\alpha_j}{ x^2 + 2\cos\left({\frac{\pi + 2\pi j}{2m} } \right)x + 1}\:dx + \int_{0}^{\infty}\frac{\beta_jx}{ x^2 + 2\cos\left({\frac{\pi + 2\pi j}{2m} } \right)x + 1}\:dx\right] \\ &=\sum_{j = 0}^{m - 1}\left[ I_1 + I_2\right] \end{align}

Evaluating each individually: \begin{align} \int_{0}^{\infty} \frac{\alpha_j}{ x^2 + 2\cos\left(\frac{\pi + 2\pi j}{2m} \right)x + 1}\:dx &= \left[ \csc\left(\frac{\pi + 2\pi j}{2m} \right)\arctan\left(\frac{(x - 1)\tan\left(\frac{\pi + 2\pi j}{4m} \right)}{x + 1} \right)\right]_{0}^{\infty} \\ &= \csc\left(\frac{\pi + 2\pi j}{2m} \right)\left( \frac{\pi + 2\pi j}{2m}\right) \end{align}

Now if we consider the second integral on it's own we find that as a general expression the integral doesn't converge. This doesn't take away from this method, but to proceed we must solve for the unknown coefficients to proceed.


Once again I will offer up a method that first converts the integral to a double integral.

For $r > 0$, we begin by enforcing a substitution of $x \mapsto x^{1/r}$. Doing so yields $$I = \frac{1}{r} \int_0^\infty \frac{x^{1/r - 1}}{1 + x} \, dx.$$

Now noting that $$\frac{1}{1 + x} = \int_0^\infty e^{-u(1 + x)} \, du,$$ our integral can be rewritten as $$I = \frac{1}{r} \int_0^\infty x^{1/r - 1} \int_0^\infty e^{-u (1 + x)} \, du \, dx,$$ or $$I = \frac{1}{r} \int_0^\infty e^{-u} \int_0^\infty x^{1/r - 1} e^{-ux} \, dx \, du,$$ after changing the order of integration.

Next we enforce a substitution of $x \mapsto x/u$. This gives \begin{align} I &= \frac{1}{r} \int_0^\infty u^{- 1/r} e^{-u} \, du \int_0^\infty x^{1/r - 1} e^{-x} \, dx\\ &= \frac{1}{r} \Gamma \left (1 - \frac{1}{r} \right ) \Gamma \left (\frac{1}{r} \right )\\ &= \frac{\pi}{r \sin \left (\frac{\pi}{r} \right )}, \end{align} where in the last line we have made use of Euler's reflexion formula for the gamma function.