Indefinite integral with geometric series I was trying to calculate the following integral
$$\int \frac{\text{d}x}{(1 + x^n)^n}$$
for $n > 0$.
I tried this road:
$$\int \frac{\text{d}x}{\left(x^n\left(1 + \frac{1}{x^n}\right)\right)^n} = \int \frac{\text{d}x}{x^{n^2}} \sum_{k = 0}^{+\infty} (-1)^k \left(\frac{1}{x^n}\right)^k = \sum_{k = 0}^{+\infty} (-1)^k \int \frac{\text{d}x}{x^{n^2 + kn}} = \sum_{k = 0}^{+\infty} (-1)^k \frac{x^{1-n (k+n)}}{1-n (k+n)}$$
The $x$ term can be taken outside the sum. With the help of Mathematica, I found out the sum is a Hypergeometric function:
$$x \sum_{k = 0}^{+\infty} (-1)^k \frac{x^{-n (k+n)}}{1-n (k+n)} = -\frac{x^{-n^2} \, _2F_1\left(1,n-\frac{1}{n};n+1-\frac{1}{n};-x^{-n}\right)}{n^2-1}$$
Yet this result doesn't match with the integration that Mathematica performs. Indeed it "should" be:
$$\int \frac{\text{d}x}{(1 + x^n)^n} = x \, _2F_1\left(\frac{1}{n},n;1+\frac{1}{n};-x^n\right)$$
which also seems to hold for every $n$ except for $n = 0$ and $n = -1$.
Any help in understanding the passages and the result?
 A: There are mistakes in the proposed derivation, since the geometric series should have been taken with an exponent $n$.
To obtain the quoted result, one can use the generalized binomial expansion
\begin{equation}
 \frac{1}{(1-z)^{s}}=\sum _{k=0}^{\infty }\binom{s+k-1}{k}z^{k}
\end{equation}
to express
\begin{align}
 f(x)&=\int \frac{dx}{(1 + x^n)^n}\\
 &=\int \sum_{k=0}^\infty\binom{n+k-1}{k}(-1)^kx^{nk}\,dx\\
 &=\sum_{k=0}^\infty\binom{n+k-1}{k}(-1)^k\frac{x^{nk+1}}{nk+1}
%  &=\frac{y^{\frac1n}}n\sum_{k=0}^\infty(-1)^k\frac{(n+k-1)_k}{k!}\frac{y^k}{\frac{1}{n}+k}
\end{align}
which can be rearranged as
\begin{align}
 f(x)&=x\sum_{k=0}^\infty\frac{\Gamma(n+k)}{k!\Gamma(n)}\frac{\left( \frac{1}{n} \right)_k}{\left( \frac{1}{n} +1\right)_k}(-1)^kx^{nk}\\
 &=x\sum_{k=0}^\infty\frac{(n)_k\left( \frac{1}{n} \right)_k}{\left( \frac{1}{n} +1\right)_k}\frac{(-x^n)^k}{k!}\\
 &=x\,_2F_1\left(n,\frac{1}{n};1+\frac{1}{n};-x^n  \right)
\end{align}
as expected. The case $n=1$ is correctly found by simplifying the hypergeometric function, while for $n=0$ the result is to be taken as the limit for $n\to0$.
