Let $k$ be a positive integer. Find all polynomials with real coefficients which satisfy the equation $P(P(x))=\left(P(x)\right)^k$.
First we note that only the constant polynomials $P \equiv 0$ and $P \equiv 1$, as well als $P \equiv -1$ for odd $k$, satisfy the equation. (This holds true for $k>1$; for $k=1$ any constant polynomial will do.)
Now if $P$ is not constant, then the range $Y = \{ P(x) : x \in \mathbb{R} \}$ of $P$ is an infinite set. For every $y \in Y$ we have $P(y) = y^k$, which means that the polynomial $Q(x) = P(x) - x^k$ is zero on $Y$. Since $Y$ is infinite, this implies that $Q$ is the zero polynomial. In conclusion, $P(x) = x^k$.
Note, first, that if $P$ is constant, then $P = P^k$, so $P$ can be any real solution of the equation $u^k - u = 0$. From now on, we shall assume that $P$ is not constant.
Let $P = cx^n + Q$ with $n \ge 1$, $c \ne 0$ and $\deg Q < n$. The equality $P(P(x)) = (P(x))^k$ means $c (cx^n + Q)^n + Q = (cx^n + Q)^k$. Developing this and equating the terms of highest degree, we get that $c^{n+1} x^{n^2} = c^k x^{nk}$, so $n = k$, which implies $c^{k+1} = c^k$. Since $c \ne 0$ we get $c = 1$.
Rewriting the conclusion above gives $(x^k + Q)^k + Q = (x^k + Q)^k$, i.e. $Q=0$, so $P = x^k$.
Therefore, the only solutions are the roots of the equation $u^k - u = 0$ and $x^k$.
Let $\deg(P(x))=n$,then $\deg(P(P(x)))=n^2,\deg(P(x))^k=nk$,so $n=k$ or $n=0$,
if $n=0$, it easy to find $P(x)=1$
if $n=k$, then let $$P(x)=a_{k}x^k+a_{k-1}x^{k-1}+\cdots+a_{0}$$ then $$[x^{k^2}](P(P(x))=(a_{k})^{k+1},[x^{k^2}](P(x))^k=(a_{k})^k$$ so we have $$a_{k}=1$$ so $$P(x)=x^k+a_{k-1}x^{k-1}+\cdots+a_{0}$$ so we have $$P(P(x))=(x^k+a_{k-1}x^{k-1}+\cdots+a_{0})^k+a_{k-1}(x^k+a_{k-1}x^{k-1}+\cdots+a_{0})^{k-1}+\cdots+a_{0}$$ and $$(P(x))^k=(x^k+a_{k-1}x^{k-1}+\cdots+a_{0})^k$$ so have $$a_{k-1}=a_{k-2}=\cdots=a_{0}=0$$