Example 1 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. (1996, Huanggang Region, Hubei Junior High School Mathematics Competition)
When $a+1=0$, i.e., $a=-1$, the original fraction becomes
$-2 x-2-6=0$.
Solving this, we get $x=-4$;
When $a+1 \neq 0$, i.e., $a \neq -1$, let the roots of the equation be $x_{1}, x_{2}$. Then
$$
x_{1}+x_{2}=\frac{a^{2}+1}{a+1}=a-1+\frac{2}{a+1} .
$$

When $a=0,1,-2,-3$, $\frac{2}{a+1}$ is an integer, and we discuss the four possible values of $a$ for $x_{1}$.

When $a=0$, the original equation becomes $x^{2}-x-6=0$. Solving this, we get
$$
x_{1}=3, \quad x_{2}=-2 ;
$$

When $a=1$, the original equation becomes $x^{2}-x-2=0$.
Solving this, we get
$$
x_{1}=2, \quad x_{2}=-1 ;
$$

When $a=-2$, the original equation becomes $-x^{2}-5 x-22=0$, which has no real roots;

When $a=-3$, the original equation becomes $-x^{2}-5 x-30=0$, which has no real roots.

From the above, we can conclude that when $a=-1,0,1$, the equation has integer roots.