Find all polynomials $P(x)$ with the property that $P(x)$ is a multiple of $P''(x).$
So we have that $$P(x) = Q(x) P''(x).$$ Now I know that if $(x-\alpha)^r$ is a root of $P(x)$ then it is also a root $P''(x)$ is $r\geq 2.$ But I don't understand how one can use this to deduce that $P(x)$ has at most $2$ distinct roots. Please explain.
If $n = \deg P \le 1$ then $P \equiv 0$, else if $\,n=2\,$ it is always (and trivially) true that $\,P'' \mid P\,$.
For $\,n \ge 3\,$ all polynomials that satisfy $\,P'' \mid P\,$ can be found as follows.
Choose an arbitrary polynomial $\,S\,$ of degree $\,n-2 \ge 1\,$ and let $\,T(x) = x^2 S(x)\,$ so that $\,T\,$ is a polynomial of degree $\,n\,$ without linear or constant terms.
The Euclidean division of $\,T\,$ by $\,T''\,$ gives $\,T(x) = Q(x)\,T''(x) + ax + b\,$ where the quotient $\,Q(x)\,$ is quadratic and the remainder $\,ax+b\,$ is (at most) linear.
Let $\,P(x) = T(x) - ax - b\,$, then $\,P'' = T''\,$ and $\,P = Q \cdot \,P''\,$, so $\,P'' \mid P\,$.
Moreover, each choice of $\,S\,$ produces a different $\,P\,$ by construction, and every $\,P\,$ corresponds to a different $\,S\,$ given by $\,S(x) = \frac{1}{x^2}\big(P(x) - P'(0)\,x - P(0)\big)\,$.
Such a polynomial $\,P\,$ can be in one of two forms.
If $\,P\,$ has a multiple root, then it must be a perfect power $\,P(x)=c(x-a)^n\,$.
To prove it, suppose $\,a\,$ is a root of $\,P\,$ with multiplicity $\,k \ge 2\,$, then it is a root with multiplicity $\,k-2\,$ of $\,P''\,$. Since $\,P = Q \cdot P''\,$ it follows that $\,a\,$ must also be a double root of $\,Q\,$ so $\,Q(x) = \lambda(x-a)^2\,$.
Since the problem is invariant to translations of $\,x\,$ and scaling of $\,P(x)\,$, it can be assumed WLOG that $\,P\,$ is monic and $\,a=0$, then:
$\,P(x) = x^k \cdot A(x)\,$ for some monic $\,A\,$ not divisible by $\,x\,$, so $\,A(0) \ne 0\,$;
$\,\lambda = \frac{1}{n(n-1)}\,$ by equating the leading coefficients, so $\,Q(x) = \frac{1}{n(n-1)} x^2\,$.
The equality $\,P = Q \cdot P''\,$ then becomes: : $$ \require{cancel} \begin{align} x^k \cdot A &= \frac{1}{n(n-1)} \,x^2 \cdot \big(k(k-1) x^{k-2} \cdot A + 2\,kx^{k-1} \cdot A' + x^k \cdot A''\big) \\ \iff\quad A &= \frac{1}{n(n-1)}\, \big(k(k-1) \cdot A + 2\,kx \cdot A' + x^2 \cdot A''\big) \end{align} $$
Setting $\,x=0\,$ gives $\,A(0) = \frac{k(k-1)}{n(n-1)}A(0)\,$, and $\,A(0) \ne 0\,$ implies $\,k=n\,$, which concludes the proof.
Otherwise, if $\,P\,$ has at least two distinct roots, then all roots must be distinct $-$ which is an immediate consequence of the first case, since a multiple root must be the only root.