Proving that if $P(X)=a_n X^n+ \cdots+a_1 X + a_0$ has only real and simple roots then $a_{k-1}a_{k+1} \le a_k^2$ How to prove that if $P(X)=a_n X^n+ \cdots+a_1 X + a_0 \in \mathbb R[X]$ has only real and simple roots then $a_{k-1}a_{k+1} \le a_k^2$ for $1 \le k \le n-1$?

How about $P(X)=X^2+X+1$?  We have $a_0=a_1=a_2=1$, so $a_1^2\geq a_0a_2$, but $P(X)$ has no real roots.
Are you trying to somehow make a connection with Newton's Inequalities (see https://en.wikipedia.org/wiki/Newton%27s_inequalities)?
EDIT: The question has been changed.  So, the counterexample above does not reflect the current question.

Solution to the Current Version:
This proof does not assume that the roots of $P(X)$ are simple.  The only requirement is that the roots are real.  Without loss of generality, we can assume that $a_n\neq 0$.  Let $k\in\{1,2,\ldots,n-1\}$.  By Newton's Inequalities, $$\left(\frac{(-1)^{n-k}a_k}{\binom{n}{k}a_n}\right)^2 \geq \left(\frac{(-1)^{n-k+1}a_{k-1}}{\binom{n}{k-1}a_n}\right)\left(\frac{(-1)^{n-k-1}a_{k+1}}{\binom{n}{k+1}a_n}\right)\,.$$
Therefore,
$$a_k^2\geq \frac{\binom{n}{k}^2}{\binom{n}{k-1}\binom{n}{k+1}}a_{k-1}a_{k+1}\,.$$
If $a_{k-1}a_{k+1}\leq 0$, the inequality $a_{k-1}a_{k+1}\leq a_k^2$ is trivial.  If $a_{k-1}a_{k+1}>0$, we observe that $\binom{n}{k}^2> \binom{n}{k-1}\binom{n}{k+1}$, so
$$a_k^2\geq \frac{\binom{n}{k}^2}{\binom{n}{k-1}\binom{n}{k+1}}a_{k-1}a_{k+1}> a_{k-1}a_{k+1}\,.$$
