Although WA's solution does solve the DEQ, it looks like a bug, so let's see if we can prove it. Also, see the nice comment by @LutzLehmann above.
We want to use Reduction of Order, given that a solution is $y_1=x$, to solve
$$\tag 1 (x^2+1)y''-2xy' +2y = 0$$
We will use these examples as a guide, assume $y_2 = v x$, and calculating derivatives
$$y_2 = v x, ~~~~y_2' = v + v' x, ~~~~y_2'' = v'' x + 2 v'$$
Substituting into $(1)$
$$v''x(x^2+1) + 2 v' = 0$$
Let $w = v' \implies w' = v''$, so
$$w'x(x^2+1) + 2 w = 0$$
Solving for $w$
$$w = \left(\dfrac{1}{x^2} + 1 \right)$$
From $v' = w = \left(\dfrac{1}{x^2} + 1 \right)$, solve for $v$
$$v = x - \dfrac{1}{x}$$
We have $y_2 = v x$, hence
$$y_2 = x^2 - 1$$
We can now write
$$y(x) = c_1 y_1(x) + c_2 y_2(x) = c_1 x + c_2(x^2-1)$$
Checking
$$(x^2+1)y''-2xy' +2y = (x^2+1) (2c_2) -2x(c_1+2 c_2 x) + 2(c_1 x + c_2(x^2-1)) = 0 ~~~~ \Large\color{\green}{\checkmark}$$