How to integrate $\frac{x^n}{1+x}$ How to integrate the function
$ \frac{x^n}{1+x} $
I tried to do it by parts but it was of no use.
I did it by taking x as $-\theta$ and did the series expansion.
I need a better method.

Write $x^n$ as $(x^n\pm 1)\mp 1$ depending on $n$ being odd or even. By integrating you will get $\pm \log(x+1)$ plus the integral of a polynomial in $x$. For instance:
$$\int\frac{x^3}{1+x}\,dx = -\log(1+x)+\int\frac{x^3+1}{x+1}\,dx = \log(1+x)+\int(x^2-x+1)\,dx\\ =-\log(1+x)+\frac{x^3}{3}-\frac{x^2}{2}+x, $$
$$\int\frac{x^4}{1+x}\,dx = \log(1+x)+\int\frac{x^4-1}{x+1}\,dx = \log(1+x)+\int(x^3-x^2+x-1)\,dx\\ =\log(1+x)+\frac{x^4}{4}-\frac{x^3}{3}+\frac{x^2}{2}-x. $$
