Given any normalized vector $|v\rangle$, that is, a vector satisfying \begin{equation} \langle v | v \rangle = 1 , \end{equation} we can construct a projection operator \begin{equation} P_v = |v \rangle \langle v| . \end{equation} The operator $P_v$ squares to itself, that is, \begin{equation} P_v^2 = P_v , \end{equation} and of course takes $|v\rangle$ to itself, that is, \begin{equation} P_v |v\rangle = |v\rangle ; \end{equation} $P_v$ projects any vector along $|v\rangle$.
If we have an orthonormal basis $\{|v>,|w>,…\}$, then \begin{align} \langle v | v \rangle = 1 &= \langle w | w \rangle = … ,\\ \langle v | w \rangle &= 0 = … . \label{ortho} \end{align} If we add up all these projections, we recover the identity matrix, that is, \begin{equation} I = |v \rangle \langle v| + |w \rangle \langle w| + … , \label{Idecomp} \end{equation} as can be easily checked by acting on each basis element in turn.
Returning to our special matrices, we have shown that both Hermitian and unitary matrices admit orthonormal basis of eigenvectors. So suppose that \begin{equation} M |v\rangle = \lambda |v\rangle , \quad M |w\rangle = \mu |w\rangle , \quad … \end{equation} where $|v\rangle$, $|w\rangle$, … satisfy (\ref{ortho}). Then (\ref{Idecomp}) is satisfied, and a similar argument shows that \begin{equation} M = \lambda |v \rangle \langle v| + \mu |w \rangle \langle w| + … , \end{equation} so that we can expand any Hermitian or unitary matrix in terms of its eigenvectors and eigenvalues.