We can write $f=a_n x^n+\cdots+a_0$ where $a_j \in \mathbb{R}$. Thus$ a_n i^n+a_{n-1} i^{n-1}+\cdots+a_0=0 .$Taking complex conjugates of both sides we have ${\overline{a_n}}^i{ }^n+\overline{a_{n-1}} i^{n-1}+\cdots+\overline{a_0}=0 .$ But $\overline{a_j}=a_j$ and $\bar{i}=-i$ so $ a_n(-i)^n+a_{n-1}(-i)^{n-1}+\cdots+a_0=0 . $