Example 1 Given that the polynomial $3 x^{3}+a x^{2}+b x+1$ can be divided by $x^{2}+1$, and the quotient is $3 x+1$. Then, the value of $(-a)^{i}$ is $\qquad$
（Dinghe Hesheng Junior High School Math Competition）
Solution: According to the polynomial identity, we have
$$
3 x^{3}+a x^{2}+b x+1=\left(x^{2}+1\right)(3 x+1) \text {. }
$$

Taking $x=1$ gives $a+b+4=8$.
Taking $x=-1$ gives $a-b-2=-4$.
Solving these, we get $a=1, b=3$.
$$
\therefore(-a)^{b}=(-1)^{3}=-1 \text {. }
$$