Let $A$ be a $n\times n$ matrix and we have $$\mathrm{tr}(A)=\mathrm{tr}(A^2)=\mathrm{tr}(A^3)=\cdots=\mathrm{tr}(A^n)=0.$$ Prove that $A$ is a nilpotent matrix.
We know $\mathrm{tr}(A)=\sum_i \lambda_i$, and $\lambda_i$ are the eigenvalues of $A$.
Let $A$ be a $n\times n$ matrix and we have $$\mathrm{tr}(A)=\mathrm{tr}(A^2)=\mathrm{tr}(A^3)=\cdots=\mathrm{tr}(A^n)=0.$$ Prove that $A$ is a nilpotent matrix.
We know $\mathrm{tr}(A)=\sum_i \lambda_i$, and $\lambda_i$ are the eigenvalues of $A$.
First of all, your condition only holds in characteristic zero. If the characteristic is $2$, for instance, the $2 \times 2$ identity matrix satisfies the conditions.
And then, note that if $\lambda_{i}$ are the eigenvalues of $A$, for $i = 1, \dots, n$, then the eigenvalues of $A^{k}$ are the $\lambda_{i}^{k}$, so that the trace of $A^{k}$ is $\sum \lambda_{i}^{k}$. Now use Newton's identities: $$ ke_k(x_1,\ldots,x_n) = \sum_{i=1}^k(-1)^{i-1} e_{k - i} (x_1, \ldots, x_n) p_i(x_1, \ldots, x_n), $$ where $e_{k}$ is the $k$-th elementary symmetric function, and $p_{k}$ is the sum of the $k$-th powers.
These show that the elementary symmetric functions in the eigenvalues are zero. These are the coefficients of the characteristic polynomial of $A$, which is then...
Lemma: $A_{n×n}$ is nilpotent if and only if all its eigenvalues are $0$.
Proof: Suppose $A$ has all eigenvalues equal to $0$. Then the characteristic polynomial of $A$ is $χ(x) = (x−\lambda_1)\cdot\dotsc\cdot(x−\lambda_n) = x^n$ so, by the Cayley-Hamilton Theorem, $\chi(A) = A^n = 0$, making $A$ nilpotent. The converse direction is obvious.
Now JBC's answer to the similar question completes the proof:
Suppose $A$ is not nilpotent, so $A$ has some non-zero eigenvalues $\lambda_1,\ldots,\lambda_r$.
Let $n_i$ the multiplicity of $\lambda_i$ then $$\left\{\begin{array}{ccc}n_1\lambda_1+\cdots+n_r\lambda_r&=&0 \\ \vdots & & \vdots \\ n_1\lambda_1^r+\cdots+n_r\lambda_r^r&=&0\end{array}\right.$$ So we have $$\left(\begin{array}{cccc}\lambda_1&\lambda_2&\cdots&\lambda_r\\\lambda_1^2 & \lambda_2^2 & \cdots & \lambda_r^2 \\ \vdots & \vdots & \vdots & \vdots \\ \lambda_1^r & \lambda_2^r & \cdots & \lambda_r^r\end{array}\right)\left(\begin{array}{c}n_1 \\ n_2 \\ \vdots \\ n_r \end{array}\right)=\left(\begin{array}{c}0 \\ 0\\ \vdots \\ 0\end{array}\right)$$ But $$\mathrm{det}\left(\begin{array}{cccc}\lambda_1&\lambda_2&\cdots&\lambda_r\\\lambda_1^2 & \lambda_2^2 & \cdots & \lambda_r^2 \\ \vdots & \vdots & \vdots & \vdots \\ \lambda_1^r & \lambda_2^r & \cdots & \lambda_r^r\end{array}\right)=\lambda_1\cdots\lambda_r\,\mathrm{det}\left(\begin{array}{cccc} 1 & 1 & \cdots & 1 \\ \lambda_1&\lambda_2&\cdots&\lambda_r\\\lambda_1^2 & \lambda_2^2 & \cdots & \lambda_r^2 \\ \vdots & \vdots & \vdots & \vdots \\ \lambda_1^{r-1} & \lambda_2^{r-1} & \cdots & \lambda_r^{r-1}\end{array}\right)\neq 0$$ (Vandermonde)So the system has a unique solution which is $n_1=\ldots=n_r=0$. Contradiction.