Answer
$P(x)=(x-1)(x+2)^{2}(x+3)(x-3).$
zeros: $-3,-2,1,3$
Work Step by Step
$P(x)=x^{5}+3x^{4}-9x^{3}-31x^{2}+36,$
($2$ sign variations, we expect $2$ or $0$ real zeros)
$P(-x)=-x^{5}+3x^{4}+9x^{3}-31x^{2}+36,$
($3$ sign variations, we expect $3 $or $1$ negative real zero)
$a_{0}=36, \quad $p: $\pm 1,\pm 2,\pm 3,\pm 4,\pm 6,\pm 9,\pm 12,\pm 16,\pm 36$
$a_{n}=1,\qquad $q: $\pm 1$
Possible rational zeros $\displaystyle \frac{p}{q}:\quad$
with synthetic division, we try$ \pm$1, $\pm$2,...
$\begin{array}{r|rrrrrrrrrrr}\hline
1 & 1 & 3 & -9 & -31 & 0 & 36 & \\
& & 1 & 4 & -5 & -36 & -36 & \\
\hline & 1 & 4 & -5 & -36 & -36 & 0 & \\
\end{array}\\\\
P(x)=(x-1)(x^{4}+4x^{3}-5x^{2}-36x-36) \\
\begin{array}{r|rrrrrrrrrrr}\hline
-2 & 1 & 4 & -5 & -36 & -36 & & \\
& & -2 & -4 & 18 & 36 & & \\
\hline & 1 & 2 & -9 & -18 & 0 & & \\
\end{array}\\
P(x)=(x-1)(x+2)(x^{3}+2x^{2}-9x-18) \\\\
\begin{array}{r|rrrrrrrrrrr}\hline
-2 & 1 & 2 & -9 & -18 & & & \\
& & -2 & 0 & 18 & & & \\
\hline & 1 & 0 & -9 & 0 & & & \\
\end{array}\\
P(x)=(x-1)(x+2)^{2}(x^{2}+0x-9) $
The last term is a difference of squares.
$P(x)=(x-1)(x+2)^{2}(x+3)(x-3).$
zeros: $-3,-2,1,3$