Let $f \neq 0$.
As you have already checked, we clearly have $f(0)=1$ and $f$ is monic. Furthermore $f$ has no real root.
Let $a \in \mathbb C$ be a complex root of $f$. Then $a^2+a+1$ is also a root of $f$. Let $p(x)=x^2+x+1$ and let $p^n(x)=p(p(p( \dotsc p(x))))$ be the $n$-fold composition of $p$ with itself.
Since $f$ has only finitely many roots, the iterated mapping $a \mapsto p(a) \mapsto p(p(a)) \mapsto \dotsc$ is periodic, i.e. $a=p^n(a)$ for some $n \geq 1$.
Hence all roots of $f$ are roots of $p^n(x)-x \in \mathbb Z[x]$ (a monic polynomial) for some $n$, hence they are algebraic integers, i.e. their absolute values are integers $\geq 1$.
Now let $a_1, \overline{a_1}, \dotsc, a_s,\overline{a_s}$ be all other roots of $f$ other than $\pm i$. In $\mathbb C[x]$ we obtain
$$f = (x^2+1)^n \prod_{i=1}^s (x-a_i)(x-\overline{a_i})$$
and $1=f(0)=\prod\limits_{i=1}^s |a_i|^2$. From $|a_i| \geq 1$ for all $i$ we get of course $|a_i|=1$ for all $i$.
So we have shown: Any root $a$ of $f$ is a complex number, which lies on the unit circle and since $a^2+a+1$ is again a root of $f$, this lies also on the unit circle.
Using $a\overline a=1$, one computes
$$1=(a^2+a+1)(\overline a^2 + \overline a +1) = 3+2(a+\overline a) + a^2 + \overline a^2,$$
i.e.
$$0=2(a+\overline a) + (a+\overline a)^2.$$
This yields $2\operatorname{Re}(a)=a + \overline a \in \{0,-2\}$, i.e. $\operatorname{Re}(a) \in \{0,-1\}$, i.e. $a=\pm i$ or $a=-1$.
Since $f$ has no real roots, we get that only $a=\pm i$ is possible. In particular
$$f = (x^2+1)^n$$
for some $n \geq 0$.
Since the proof is very long, I will recap the main ideas of the proof:
- $f(0)=1$ and $f$ is monic, i.e. the product of all roots is $1$.
- All roots are algebraic integers, i.e. their absolute values are integers $\geq 1$
- From 1. and 2. we get that all roots are contained on the unit circle.
- The only elements $a$ on the unit circle with the property that $a^2+a+1$ is again on the unit circle are $-1$ and $\pm i$.
- Hence the only possible roots are $-1$ and $\pm i$, but one can easily rule out $-1$. So $\pm i$ are the only possible roots.