Integrate the following : $\displaystyle\int \frac{x^n+1}{(x^n-1) \sqrt {x^4+1}} dx$ ; n is odd. My original Question :
$\displaystyle\int \frac{x^3+1}{(x^3-1) \sqrt {x^4+1}} dx $
What to substitute? How to do it?
I want to add that I have tried doing this using substitutions as : 
$x = \frac{1}{t}$ and considered the equation $\displaystyle \frac{1-tan^2 \theta}{1+tan^2 \theta} = \cos 2\theta$ but none of these came to any use. 
Also I'm aware of a brother of this problem : $\displaystyle\int \frac{x^2+1}{(x^2-1) \sqrt {x^4+1}} dx$
which also seems like one of Elliptic family as found here : How do I integrate the following? $\int{\frac{(1+x^{2})\mathrm dx}{(1-x^{2})\sqrt{1+x^{4}}}}$
So now I want to re-phrase my question into some general one : 
What is the general solution of $\displaystyle\int \frac{x^n+1}{(x^n-1) \sqrt {x^4+1}} dx$
(Specially when n is odd.)
 A: First, introduce variables $y, z$ such that $x + x^{-1} = y = \frac{1}{\sqrt{2}}(z+z^{-1})$, we have
$$\begin{align}
 & \frac{x+1}{x-1}\frac{dx}{\sqrt{x^4+1}}
= \frac{x+1}{x-1}\frac{1}{\sqrt{x^2+x^{-2}}}\frac{dx}{x}
= \frac{x+1}{x-1}\frac{1}{\sqrt{(x+x^{-1})^2-2}}\frac{d(x+x^{-1})}{x-x^{-1}}\\
= & \frac{dy}{(y-2)\sqrt{y^2-2}}\\
= & \frac{\sqrt{2}}{z+z^{-1}-2\sqrt{2}}\frac{d(z+z^{-1})}{\sqrt{(z+z^{-1})^2-4}}
= \frac{\sqrt{2}}{z+z^{-1}-2\sqrt{2}}\frac{d(z+z^{-1})}{z-z^{-1}}
= \frac{\sqrt{2}dz}{z^2-2\sqrt{2}z+1}
\end{align}
$$
Next, for any $n > 1$, we have
$$\frac{x^n - 1}{x-1} = x^{\frac{n-1}{2}}\frac{x^{\frac{n}{2}} - x^{-\frac{n}{2}}}{x^{\frac12}-x^{-\frac12}} = x^{\frac{n-1}{2}} U_{n-1}\left(\frac{x^{\frac12} + x^{-\frac12}}{2}\right)$$
where $U_m(x)$ is the $m^{th}$ Chebyshev polynomial of the $2^{nd}$ kind. When $n = 2k+1$ is an odd number $U_{n-1}(t)$ is an even polynomial of degree $2k$. This means there is a polynomial $f_k(t)$ of degree $k$ such that
$$\frac{x^{2k+1} - 1}{x-1} = x^{k}f_k\left((x^{\frac12} + x^{-\frac12})^2\right)
= x^{k} f_k(y+2)$$
Replace $x$ by $-x$, we get
$$\frac{x^{2k+1} + 1}{x+1} = (-x)^k f_k(-y+2)$$
Combine these, we find 
$$\frac{x^{2k+1}+1}{x^{2k+1}-1} = \frac{x+1}{x-1} g_k(y)$$ where
$\displaystyle\;g_k(y) = (-1)^k\frac{f_k(2-y)}{f_k(2+y)}$ is a rational function in $y$.
As a result, when $n = 2k+1$ is odd, the integral can be transformed to
a integral over a rational function in $z$.
$$\mathcal{I}_n \stackrel{def}{=}\int \frac{x^n+1}{x^n-1}\frac{dx}{x^4+1} = \int g_k\left(\frac{z + z^{-1}}{\sqrt{2}}\right)\frac{\sqrt{2}{dz}}{z^2-2\sqrt{2}z+1}$$
For example, when $n = 3$, $U_{2k}(t) = 4t^2 - 1 \implies f_k(t) = t - 1$.
This implies
$$g_1(y) = (-1)^1\frac{(2-y)-1}{(2+y)-1} = \frac{y-1}{y+1}$$
and the integral becomes
$$\begin{align}\mathcal{I}_3 
&=\int \frac{y-1}{(y+1)(y-2)}\frac{dy}{\sqrt{y^2-2}}
= \frac13 \int \left(\frac{2}{y+1} + \frac{1}{y-2}\right)\frac{dy}{\sqrt{y^2-2}}\\
&= \frac{\sqrt{2}}{3}\int \left(\frac{2}{z^2 + \sqrt{2}z + 1} + \frac{1}{z^2 - 2\sqrt{2}z + 1}\right) dz\\
&= \frac{4}{3}\tan^{-1}(1+\sqrt{2}z) + \frac{1}{3\sqrt{2}}\log\left(\frac{z-\sqrt{2}-1}{z-\sqrt{2}+1}\right) + \text{const...}
\end{align}
$$
