Does $x^2\equiv x\pmod p$ imply $x^2\equiv x\pmod {p^n}$ for all $n$? Suppose $x^2\equiv x\pmod p$ where $p$ is a prime, then is it generally true that $x^2\equiv x\pmod {p^n}$ for any natural number $n$? And are they the only solutions?

No, it is not generally true. For example, 
$$6^2=36\equiv 6\bmod 5$$
but
$$6^2=36\not\equiv 6\bmod 25.$$

Suppose we are given an integer $x$. Note that, for any prime power $p^n$, 
$$x^2\equiv x\pmod {p^n}\iff p^n\mid x(x-1)\iff p^n\mid x\;\; \text{ or }\;\;p^n\mid (x-1)$$
because $x$ and $x-1$ are relatively prime. Therefore, 
$$x^2\equiv x\pmod {p^n}$$
is true if and only if $$n\leq\max\{v_p(x),v_p(x-1)\}$$
where $v_p(d)$ denotes the number of times $p$ goes into $d$. 
