How to find the indefinite integral $\int \frac{dx}{1+x^{n}}$? How to find the indefinite integral $$\int \frac{dx}{1+x^{n}}$$  where n is a positive integer? 
 A: I just wanted to comment to give the general formula for this explicitly in case you have interest, but I can't comment so I must post an answer. For $n=2q-1,$ with $q\in\mathbb{N},$ and $m<n$ both natural numbers,
$$\int\frac{x^{m-1}}{x^n+1}dx=\frac{\left(-1\right)^{m-1}}{n}\log\left(x+1\right)\\-\frac{1}{n}\sum\limits_{k=1}^{\frac{n-1}{2}}\cos\frac{(2k-1)m\pi}{n}\log\left(x^2-2x\cos\frac{(2k-1)\pi}{n}+1\right)\\+\frac
{2}{n}\sum\limits_{k=1}^{\frac{n-1}{2}}\sin\frac{(2k-1)m\pi}{n}\tan^{-1}\frac{x-\cos\frac{(2k-1)\pi}{n}}{\sin\frac{(2k-1)\pi}{n}}.$$ If $n=2q,$
$$\int\frac{x^{m-1}}{x^n+1}dx=-\frac{1}{n}\sum\limits_{k=1}^{n/2}\cos\frac{(2k-1)m\pi}{n}\log\left(x^2-2x\cos\frac{(2k-1)\pi}{n}+1\right)\\+\frac
{2}{n}\sum\limits_{k=1}^{n/2}\sin\frac{(2k-1)m\pi}{n}\tan^{-1}\frac{x-\cos\frac{(2k-1)\pi}{n}}{\sin\frac{(2k-1)\pi}{n}}.$$
Method of proof:
Partial fractions are obtained by $$\frac{x^{m-1}}{x^n+1}=\frac{1}{n}\sum\limits_{\alpha}\frac{\alpha^m}{x-\alpha},$$ where $\alpha^n+1=0.$ If $n$ is odd it is clear the first $\alpha$ is $-1.$ The rest of the terms must be from
$$\frac{e^{\frac{(2k-1)m\pi}{n}i}}{x-e^{\frac{(2k-1)\pi}{n}i}}+\frac{e^{-\frac{(2k-1)m\pi}{n}i}}{x-e^{-\frac{(2k-1)\pi}{n}i}}=\frac{2\cos\frac{(2k-1)m\pi}{n}\left(x-\cos\frac{(2k-1)\pi}{n}\right)-2\sin\frac{(2k-1)m\pi}{n}\sin\frac{(2k-1)\pi}{n}}{x^2-2x\cos\frac{(2k-1)\pi}{n}+1}$$ and integrate from here; $$\int\frac{dx}{x^2+r^2}=\frac{1}{r}\tan^{-1}\frac{x}{r}.$$
A: We have $f(x)=\frac{1}{x^n+1}$.  Note that we can write 
$$f(x)=\prod_{k=1}^n(x-x_k)^{-1} \tag {1}$$
where $x_k=e^{i(2k-1)\pi/n}$, $k=1, \cdots,n$.  
We can also express $(1)$ as 
$$f(x)=\sum_{k=1}^na_k(x-x_k)^{-1} \tag {2}$$
where $a_k=\frac{-x_k}{n}$  (See the NOTE at the end of the development).
Now, we can write
$$\begin{align}
\int\frac{1}{x^n+1}dx=-\frac1n\sum_{k=1}^nx_k\log(x-x_k)+C
\end{align}$$
which can be more explicitly written as 
$$\bbox[5px,border:2px solid #C0A000]{\int\frac{1}{x^n+1}dx=-\frac1n\sum_{k=1}^n\left(\frac12 x_{kr}\log(x^2-2x_{kr}x+1)-x_{ki}\arctan\left(\frac{x-x_{kr}}{x_{ki}}\right)\right)+C'}
$$
where $x_{kr}$ and $x_{ki}$ are the real and imaginary parts of $x_k$, respectively, and are given by
$$x_{kr}=\text{Re}\left(x_k\right)=\cos \left(\frac{(2k-1)\pi}{n}\right)$$
$$x_{ki}=\text{Im}\left(x_k\right)=\sin \left(\frac{(2k-1)\pi}{n}\right)$$

NOTE:
We will derive the form $a_k=-\frac{x_k}{n}$.  To that end, we use $(2)$ and observe that
$$\begin{align}
\lim_{x\to x_\ell}\left((x-x_{\ell})\sum_{k=1}^{n}a_k(x-x_k)^{-1}\right)&=\lim_{x\to x_\ell}\left((x-x_{\ell})\frac{1}{1+x^n}\right) \tag 3 
\end{align}$$
The left-hand side of $(3)$ is simply $a_{\ell}$.  For the right-hand side, straightforward application of L'Hospital's Rule yields 
$$\begin{align}
\lim_{x\to x_\ell}\left(\frac{(x-x_{\ell})}{1+x^n}\right)&=\frac{1}{nx_{\ell}^{n-1}}
\end{align}$$
Finally, we note that since $x_{\ell}^n=-1$, then 
$$\begin{align}
\frac{1}{nx_{\ell}^{n-1}}&=\frac{x_{\ell}}{nx_{\ell}^n}\\\\
&=-\frac{x_{\ell}}{n}
\end{align}$$
Thus, we have that 
$$\bbox[5px,border:2px solid #C0A000]{a_{k}=-\frac{x_k}{n}}$$
