<s>[INST] How to simplify a polynomial expression? Let's say I have a polynomial expression as:

$2 - 3x + x^3 $

How do I simplify the above expression to:

$(1 - x)^2(2 + x)$

 [/INST] In this case where you know the ending expression, you can add-and-subtract in such a way that forces terms of the final expression to appear. For example, to force $2+x$ to appear, we have:
\begin{align*}
2-3x+x^3&=2+\color{red}{x}-\color{red}{x}-3x+x^3\\
&=2+x-4x+x^3\\
&=2+x-4x-\color{red}{2x^2}+\color{red}{2x^2}+x^3\\
&=(2+x)-2x(2+x)+x^2(2+x)\\
&=(2+x)(1-2x+x^2).
\end{align*}
Each time $\color{red}{\text{add}}$-and-$\color{red}{\text{subtract}}$ happens, it does so in a way to induce $x+2$ to happen. Now you can do the same to $1-2x+x^2$ to make $1-x$ appear:
$$
1-2x+x^2=1-\color{red}{x}+\color{red}{x}-2x+x^2=1-x-x+x^2=(1-x)-x(1-x)=\ldots
$$
How does one know $2+x$ is a factor of $2-3x+x^3$? In general, $px+q$ with $p\neq 0$ is factor of a polynomial $P(x)$ iff $-\frac{q}{p}$ is a root of $P(x)$. And to find such $p$ and $q$, you can refer to the Rational root theorem.
</s>