Example 9 Let $n(n \geqslant 2)$ be a positive integer, try to find all real-coefficient polynomials $P(x)=a_{n} x^{n}+a_{n-1} x^{n-1}+$ $\cdots+a_{1} x+a_{0}$, such that $P(x)$ has exactly $n$ real roots no greater than -1, and $a_{0}^{2}+a_{1} a_{n}=a_{n}^{2}+a_{0} a_{n-1}$.
Solution: From the condition, we can set $P(x)=a_{n}\left(x+\beta_{1}\right)\left(x+\beta_{2}\right) \cdots\left(x+\beta_{n}\right)$, where $\beta_{i} \geqslant 1(i=1,2, \cdots, n)$, and $a_{n} \neq 0$.

From $a_{0}^{2}+a_{1} a_{n}=a_{n}^{2}+a_{0} a_{n-1}$, we get $a_{n}^{2}\left(\prod_{i=1}^{n} \beta_{i}\right)^{2}+a_{n}^{2}\left(\prod_{i-1}^{n} \beta_{i}\right)\left(\sum_{i=1}^{n} \frac{1}{\beta_{i}}\right)=a_{n}^{2}+$ $\left(\prod_{i=1}^{n} \beta_{i}\right)\left(\sum_{i=1}^{n} \beta_{i}\right) a_{n}^{2}$.
Thus, $\prod_{i=1}^{n} \beta_{i}-\prod_{i=1}^{n} \frac{1}{\beta_{i}}=\sum_{i=1}^{n} \beta_{i}-\sum_{i=1}^{n} \frac{1}{\beta_{i}} \cdots$ (1)
Below, we prove by mathematical induction on $n$:
When $\beta_{i} \geqslant 1(i=1,2, \cdots, n)$, we have
$$
\prod_{i=1}^{n} \beta_{i}-\prod_{i=1}^{n} \frac{1}{\beta_{i}} \geqslant \sum_{i=1}^{n} \beta_{i}-\sum_{i=1}^{n} \frac{1}{\beta_{i}}.
$$

Equality holds if and only if $n-1$ of $\beta_{1}, \beta_{2}, \cdots, \beta_{n}$ are equal to 1.
When $n=2$, if $\beta_{1}, \beta_{2} \geqslant 1$, then
$\beta_{1} \beta_{2}-\frac{1}{\beta_{1} \beta_{2}} \geqslant\left(\beta_{1}+\beta_{2}\right)-\left(\frac{1}{\beta_{1}}+\frac{1}{\beta_{2}}\right) \Leftrightarrow\left(\beta_{1} \beta_{2}\right)^{2}-1 \geqslant\left(\beta_{1}+\beta_{2}\right)\left(\beta_{1} \beta_{2}-1\right)$
$\Leftrightarrow\left(\beta_{1} \beta_{2}-1\right)\left(\beta_{1}-1\right)\left(\beta_{2}-1\right) \geqslant 0$.
Therefore, the proposition holds when $n=2$.
Assume it holds when $n=k$, then when $n=k+1$, let $\alpha=\beta_{k} \beta_{k+1}$, by the induction hypothesis we have
$$
\prod_{i=1}^{k+1} \beta_{i}-\prod_{i=1}^{k+1} \frac{1}{\beta_{i}} \geqslant \sum_{i=1}^{k-1} \beta_{i}-\sum_{i=1}^{k-1} \frac{1}{\beta_{i}}+\alpha-\frac{1}{\alpha}.
$$

Equality holds if and only if $k-1$ of $\beta_{1}, \beta_{2}, \cdots, \beta_{k-1}, \alpha$ are equal to 1.
From the case when $n=2$, we know
$\alpha-\frac{1}{\alpha}=\beta_{k} \beta_{k+1}-\frac{1}{\beta_{k} \beta_{k+1}} \geqslant \beta_{k}+\beta_{k+1}-\frac{1}{\beta_{k}}-\frac{1}{\beta_{k+1}}$.
Thus, $\prod_{i=1}^{n+1} \beta_{i}-\prod_{i=1}^{n+1} \frac{1}{\beta_{i}} \geqslant \sum_{i=1}^{n+1} \beta_{i}-\sum_{i=1}^{n+1} \frac{1}{\beta_{i}}$.
Equality holds if and only if $k-1$ of $\beta_{1}, \beta_{2}, \cdots, \beta_{k-1}, \alpha$ are equal to 1, and one of $\beta_{k}, \beta_{k-1}$ is equal to 1.
This is equivalent to $k$ of $\beta_{1}, \beta_{2}, \cdots, \beta_{k-1}, \beta_{k}, \beta_{k+1}$ being equal to 1.
Thus, the conclusion holds for $n=k+1$, and therefore for all positive integers.
From the above conclusion and (1), we know that polynomials of the form $P(x)=a_{n}(x+1)^{n-1}(x+\beta)\left(a_{n} \neq 0, \beta \geqslant 1\right)$ are all the polynomials that satisfy the condition.