How can we factor $ q^4 + q^2 + 1$
Hint $ $ completing the square leads to a difference of squares, e.g.
$$\begin{eqnarray}\overbrace{q^4+1}^{\rm incomplete\ \large \Box\!\!}\!\!\! + q^2\!&\,=\,&\!\! \overbrace{(q^2+1)^2}^{\rm complete\ the\ \Large\Box \ \!\!\!}\!\!\!- \color{#c00}{q}^2\ \ \text{so, factoring this} \it\text{ difference of squares}\\ &\,=\,& (q^2+1\,\ -\, \color{#c00}{q})\,(q^2+1+\,\color{#c00}{q})\\ \end{eqnarray}\qquad\quad\ \ \ $$ Here is another common example
$$\begin{eqnarray} n^4+4k^4 &\,=\,& \overbrace{(n^2\!+2k^2)^2}^{\rm\!\!\! complete\ the\ \large \Box\!\!\!}\!\!\!-\!(\color{#c00}{2nk})^2\ \ \text{so, factoring this} \it\text{ difference of squares}\\ &\,=\,& (n^2\!+2k^2\ -\,\ \color{#c00}{2nk})\,(n^2\!+2k^2+\,\color{#c00}{2nk})\\ &\,=\,&(\underbrace{(n-k)^2}_{\rm\!\!\!\!\!\!\!\!\!\!\! complete\ the\ \large \Box\!\!\!\!\!\!\!\!}\ +\ \,k^2)\ \ \underbrace{((n+k)^2}_{\rm\!\!\!\!\!\!\!\!\!\!\! complete\ the\ \large \Box\!\!\!\!\!\!\!\!\!\!\!\!\!\!} +\,k^2)\\ \end{eqnarray}$$
$$1+q^2+q^4=(1+q+q^2)(1+q^2-q)$$ Notice how $1^2=1$ and $(q^2)^2=q^4$, so $(1+q^2)^2$ will get us a few terms already: $$(1+q^2)^2=1+q^4+2q^2$$ Hence: $$1+q^2+q^4=(1+q^2)^2-q^2$$ Which is the difference of two squares, something we know we can factor: $$1+q^2+q^4=(1+q^2)^2-q^2=((1+q^2)+q)((1+q^2)-q)=(1+q^2+q)(1+q^2-q)$$
Some often used rules for factoring are: $$(a+b)^2=a^2+b^2+2ab$$ $$(a-b)(a+b)=a^2-b^2$$ $$(a-1)(1+a+a^2+...+a^n)=a^{n+1}-1$$