$$\int \frac{x^2-1}{x^4+x^3+x^2+x+1} dx$$
My attempt:
$$x^4+x^3+x^2+x+1=[2x^2+(1+\sqrt{5})x+2][2x^2+(1-\sqrt{5})x+2]$$
$$ x^4+x^3+x^2+x+1= \frac{ \frac{-4\sqrt{5}}{5}\cdot x -(\frac{\sqrt{5}}{5}+1) }{2x^2+(1+\sqrt{5})x+2}+ \frac{ \frac{4\sqrt{5}}{5}\cdot x +\frac{\sqrt{5}}{5}-1 }{2x^2+(1-\sqrt{5})x+2}$$
$$\int \frac{x^2-1}{x^4+x^3+x^2+x+1} dx= \int \left[\frac{ \frac{-4\sqrt{5}}{5}\cdot x -(\frac{\sqrt{5}}{5}+1) }{2x^2+(1+\sqrt{5})x+2}+ \frac{ \frac{4\sqrt{5}}{5}\cdot x +\frac{\sqrt{5}}{5}-1 }{2x^2+(1-\sqrt{5})x+2}\right]dx$$
When I try to solve the question after this part, I get the wrong answer every time. I would appreciate it if you could show me how to solve the next part.
Answer:$\frac{1}{\sqrt{5}}\cdot ln \left| \frac{2x^2+(1-\sqrt{5})x+2}{2x^2+(1+\sqrt{5})x+2} \right| + C$
Another straightforward approach would be to divide numerator and denominator by $x^2$
$$\int \frac{1-\frac{1}{x^2}}{x^2+x+1+\frac{1}{x}+\frac{1}{x^2}}dx = \int \frac{d\left(x+\frac{1}{x}\right)}{\left(x+\frac{1}{x}\right)^2+\left(x+\frac{1}{x}\right)-1}$$
And then complete the square
$$\int \frac{d\left(x+\frac{1}{x}+\frac{1}{2}\right)}{\left[\left(x+\frac{1}{x}\right)+\frac{1}{2}\right]^2-\frac{5}{4}}$$
which suggests using the substitution
$$x+\frac{1}{x} + \frac{1}{2} = \frac{\sqrt{5}}{2}\operatorname{coth} t\implies d\left(x+\frac{1}{2}+\frac{1}{2}\right) = - \frac{\sqrt{5}}{2} \operatorname{csch}^2 t \: dt$$
This simplifies the integrand to
$$\int -\frac{2}{\sqrt{5}} \:dt$$
and a final answer of
$$-\frac{2}{\sqrt{5}}\operatorname{coth}^{-1}\left[\frac{2}{\sqrt{5}}\left(x+\frac{1}{x}+\frac{1}{2}\right)\right]+C$$
which is equivalent to your given answer as inverse hyperbolic can be written as logs via Pythagoras.