Example 4. Find all integer values of $a$ such that the equation $(a+1) x^{2}-\left(a^{2}+1\right) x$ $+2 a^{3}-6=0$ has integer roots. (1990,

 untranslated text retained as requested.
When $a=-1$, the original equation has an integer root $x=-4$. If $a \neq-1$, then by Vieta's formulas,
$$
x_{1}+x_{2}=a-1+\frac{2}{a+1} \text {. }
$$
Thus, $a+1= \pm 1, \pm 2$. That is, $a=0,-2,1,-3$.
$\because$ When $a=0$, the solutions of the original equation are $x_{1}=-2, x_{2}=3$; when $a=-2$, the original equation has no integer roots; when $a=1$, the solutions of the original equation are $x_{1}=-1, x_{2}=2$; when $a=-3$, the original equation has no integer roots. Therefore, the values of $a$ are $-1,0,1$.