Another necessary condition has to be stated that a matrix has a basis of eigenvectors, which is equivalent to saying it is diagonalizable. Without it, a matrix such as
$$A = \begin{pmatrix}1 & 1 \\ 0 & 1\end{pmatrix}$$
provides a counterexample: it's only eigenvalue is $1$, but it is neither involutary nor idempotent:
$$A^2 = \begin{pmatrix}1 & 2 \\ 0 & 1\end{pmatrix}$$
If, however, a matrix is diagonalizable, and all eigenvalues are $0$ and $1$, then in eivenvector basis it looks like
$$\begin{pmatrix}
1 & 0 & 0 & \dots & 0 \\
0 & 0 & 0 & \dots & 0 \\
0 & 0 & 1 & \dots & 0 \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
0 & 0 & 0 & \dots & 0
\end{pmatrix}$$
with only $1$s and $0$s on the diagonal, so it is clearly idempotent.
A similar argument holds for $\lambda \in \{-1,1\}$ and involutary matrices.