How do I evaluate $\int \frac{x+1}{(x^2+1) \sqrt{x^2-6x+1}} dx$? I am trying to evaluate this indefinite integral:
$$\int \frac{x+1}{(x^2+1) \sqrt{x^2-6x+1}} dx$$
What I tried

*

*Substitution $u = \arctan(x)$. However, no luck after this

*Find substitutions to convert $x^2 - 6x + 1$ into $(a + bu)^2$ or $a - (b + cu)^2$, however I could not find any

*Converted $x^2 - 6x + 1$ into $(x-3)^2 - 8$ and used the derivative of $\sec^{-1}{(x)}$ but not any luck after that as well.

*I suspect that it has a real solution, so the solution from wolfram alfa is not what I am looking for.

Any help/solutions would be very much appreciated!
 A: Hint:
You can rationalize with the substitution
$$\frac{x-3}{\sqrt 2}=t+\frac1t.$$
Then decompose in simple fractions. This is a little tedious. To get the final answer, you need to inverse the substitution, by solving
$$t^2-\frac{x-3}{\sqrt 2}t+1=0.$$
A: Dividing numerator and denominator by $x$ and pulling out a factor of $\sqrt{x}$ gives
$$I = \int \frac{1+\frac{1}{(\sqrt{x})^2}}{\left(\left(\sqrt{x}-\frac{1}{\sqrt{x}}\right)^2+2\right)\sqrt{\left(\sqrt{x}-\frac{1}{\sqrt{x}}\right)^2-4}}\cdot \frac{2dx}{2\sqrt{x}}$$
This suggests using the substitution $$\sqrt{x}-\frac{1}{\sqrt{x}} = 2\cosh t$$
which simplifies the integral to
$$I = \int \frac{dt}{2\cosh^2t+1} = \int \frac{\operatorname{sech}^2 t\:dt}{3-\tanh^2t}=\frac{1}{\sqrt{3}}\tanh^{-1}\left(\frac{\tanh t}{\sqrt{3}}\right)+C$$
Using that
$$\tanh^2t = 1-\operatorname{sech}^2t = 1-\frac{4x}{(x-1)^2} = \frac{x^2-6x+1}{(x-1)^2}$$
we get a final answer of
$$I = \frac{1}{\sqrt{3}}\tanh^{-1}\left(\frac{1}{|x-1|}\sqrt{\frac{x^2-6x+1}{3}}\right)+C$$
