$6.2 .9 \star \star$ Let $n(\geqslant 2)$ be a positive integer, find all real-coefficient polynomials
$$
P(x)=a_{n} x^{n}+a_{n-1} x^{n-1}+\cdots+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}$.
Given the conditions, we can set \( P(x) = a_n (x + \beta_1)(x + \beta_2) \cdots (x + \beta_n) \), where \(\beta_i \geq 1, i = 1, 2, \cdots, n\), and \(a_n \neq 0\).
Using \(a_0^2 + a_1 a_n = a_n^2 + a_0 a_{n-1}\), we have

Thus,
\[
\begin{array}{c}
a_n^2 \left( \prod_{i=1}^n \beta_i \right)^2 + a_n^2 \left( \prod_{i=1}^n \beta_i \right) \sum_{i=1}^n \frac{1}{\beta_i} = a_n^2 + \left( \prod_{i=1}^n \beta_i \right) \left( \sum_{i=1}^n \beta_i \right) a_n^2, \\
\prod_{i=1}^n \beta_i - \frac{1}{\prod_{i=1}^n \beta_i} = \sum_{i=1}^n \beta_i - \sum_{i=1}^n \frac{1}{\beta_i}.
\end{array}
\]

We will use mathematical induction on \(n\) to prove that when \(\beta_i \geq 1, i = 1, 2, \cdots, n\), we have
\[
\prod_{i=1}^n \beta_i - \frac{1}{\prod_{i=1}^n \beta_i} \geq \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, \cdots, \beta_n\) are equal to 1.
When \(n = 2\), if \(\beta_1, \beta_2 \geq 1\), the following equivalent relations hold:
\[
\begin{aligned}
& \beta_1 \beta_2 - \frac{1}{\beta_1 \beta_2} \geq (\beta_1 + \beta_2) - \left( \frac{1}{\beta_1} + \frac{1}{\beta_2} \right) \\
\Leftrightarrow & (\beta_1 \beta_2)^2 - 1 \geq (\beta_1 + \beta_2)(\beta_1 \beta_2 - 1) \\
\Leftrightarrow & (\beta_1 \beta_2 - 1)(\beta_1 - 1)(\beta_2 - 1) \geq 0.
\end{aligned}
\]

Therefore, the proposition holds for \(n = 2\).
Assume the proposition holds for \(n = k\). When \(n = k + 1\), let \(\alpha = \beta_k \beta_{k+1}\). By the induction hypothesis, we have
\[
\prod_{i=1}^{k+1} \beta_i - \frac{1}{\prod_{i=1}^{k+1} \beta_i} \geq \left( \sum_{i=1}^{k-1} \beta_i - \sum_{i=1}^{k-1} \frac{1}{\beta_i} \right) + \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 \(n = 2\), we know \(\alpha - \frac{1}{\alpha} = \beta_k \beta_{k+1} - \frac{1}{\beta_k \beta_{k+1}} \geq \beta_k + \beta_{k+1} - \frac{1}{\beta_k} - \frac{1}{\beta_{k+1}}\), thus
\[
\prod_{i=1}^{k+1} \beta_i - \frac{1}{\prod_{i=1}^{k+1} \beta_i} \geq \sum_{i=1}^{k+1} \beta_i - \sum_{i=1}^{k+1} \frac{1}{\beta_i},
\]

Equality holds if and only if \(k-1\) of \(\beta_1, \cdots, \beta_{k-1}, \alpha\) are equal to 1, and one of \(\beta_k\) and \(\beta_{k+1}\) is equal to 1, which is equivalent to \(k\) of \(\beta_1, \cdots, \beta_{k+1}\) being equal to 1.

From the above conclusion and (1), we know that polynomials of the form \(P(x) = a_n (x + 1)^{n-1} (x + \beta), a_n \neq 0, \beta \geq 1\) are all the polynomials that satisfy the conditions.