[guided]The point of this direction is to turn the positive semidefinite matrix $Q$ into actual square summands. A positive semidefinite matrix behaves like a Gram matrix, and we now construct that Gram representation explicitly.
Define the symmetric bilinear map $B: \mathbb{R}^m \times \mathbb{R}^m \to \mathbb{R}$ by
\begin{align*}
B(u,v) := u^\top Qv.
\end{align*}
Because $Q$ is symmetric, $B$ is symmetric and bilinear. Because $Q$ is positive semidefinite, $B(u,u) \geq 0$ for every $u \in \mathbb{R}^m$. The only possible obstruction to being an inner product is that some nonzero vectors may have zero length. We remove precisely those vectors by defining
\begin{align*}
N := \{u \in \mathbb{R}^m : B(u,u)=0\}.
\end{align*}
We now prove the null-space property needed for the quotient. Fix $u \in N$ and $v \in \mathbb{R}^m$. For every $t \in \mathbb{R}$, positive semidefiniteness gives
\begin{align*}
0 \leq B(v+tu,v+tu)=B(v,v)+2tB(u,v)+t^2B(u,u)=B(v,v)+2tB(u,v).
\end{align*}
If $B(u,v)>0$, then taking $t< -B(v,v)/(2B(u,v))$ contradicts this inequality. If $B(u,v)<0$, then taking $t> -B(v,v)/(2B(u,v))$ contradicts it. Hence $B(u,v)=0$. Therefore $B$ descends to a genuine inner product on the quotient space $\mathbb{R}^m/N$.
Choose an orthonormal basis $e_1,\dots,e_r$ of this quotient [inner product space](/page/Inner%20Product%20Space). Let $b_i \in \mathbb{R}^m$ be the $i$th standard basis vector, and let $\pi_i$ be the class of $b_i$ in $\mathbb{R}^m/N$. Define
\begin{align*}
v_i := ((\pi_i,e_1),\dots,(\pi_i,e_r))^\top \in \mathbb{R}^r.
\end{align*}
Since $e_1,\dots,e_r$ is orthonormal, the inner product of $\pi_i$ and $\pi_j$ is the Euclidean dot product of their coordinate vectors:
\begin{align*}
(\pi_i,\pi_j) = v_i^\top v_j.
\end{align*}
But the quotient inner product was induced by $B$, so
\begin{align*}
(\pi_i,\pi_j) = B(b_i,b_j) = b_i^\top Qb_j = Q_{ij}.
\end{align*}
Thus $Q_{ij}=v_i^\top v_j$ for all $i,j$.
Now define, for each $\ell \in \{1,\dots,r\}$, the polynomial map $s_\ell: \mathbb{R}^n \to \mathbb{R}$ by
\begin{align*}
s_\ell(x) := \sum_{i=1}^m (v_i)_\ell x^{\alpha_i}.
\end{align*}
Each $s_\ell$ has degree at most $d$, because every monomial $x^{\alpha_i}$ appearing in $z_d$ has $|\alpha_i| \leq d$. Expanding the assumed Gram representation gives
\begin{align*}
p(x) = z_d(x)^\top Qz_d(x).
\end{align*}
Therefore
\begin{align*}
p(x) = \sum_{i=1}^m \sum_{j=1}^m Q_{ij}x^{\alpha_i}x^{\alpha_j}.
\end{align*}
Substituting $Q_{ij}=\sum_{\ell=1}^r (v_i)_\ell(v_j)_\ell$ and regrouping the finite sums yields
\begin{align*}
p(x) = \sum_{\ell=1}^r \left(\sum_{i=1}^m (v_i)_\ell x^{\alpha_i}\right)^2.
\end{align*}
By the definition of $s_\ell$, this is
\begin{align*}
p(x) = \sum_{\ell=1}^r s_\ell(x)^2.
\end{align*}
This is exactly a finite sum of squares of real polynomials, so $p$ is a sum of squares.[/guided]