<s>[INST] What is the method to factor $x^3 + 1$? In the solution to a problem, it's stated that 

We see that $x^3+1=(x+1)(x^2-x+1)$.

Why is this, and what method can I use for similar problems with different coefficients?
The full problem is 

Find the remainder when $x^{81}+x^{48}+2x^{27}+x^6+3$ is divided by $x^3+1$. 

 [/INST] Since $(-1)^3+1=0,$ we know that $x^3+1$ is divisible by $x+1$, which gives the following way:
$$x^3+1=x^3+x^2-x^2-x+x+1=x^2(x+1)-x(x+1)+x+1=(x+1)(x^2-x+1).$$
</s>