Proof (spectral theorem for real symmetric and Hermitian matrices)

Let $\mathbb{F} = \R$ (resp. $\C$). Equip $\mathbb{F}^n$ with the standard dot product. The map $$ \begin{align*} \alpha: \mathbb{F}^n &\to \mathbb{F}^n \\ \v v &\mapsto A\v v \end{align*} $$ is self-adjoint, so there exists an orthonormal basis $\set{\v v_1, \ldots, \v v_n}$ for $\mathbb{F}^n$ consisting of eigenvectors of $A$ with real eigenvalues $\lambda_1, \ldots, \lambda_n$.

Let $$ \begin{align*} P = \pmat{\v v_1^T \\ \vdots \\ \v v_n^T}. \end{align*} $$ Note that $(P\, \overline{P}^T)_{ij} = \v v_i^T \overline{\v v_j} = \delta_{ij}$ by orthonormality, so $P\in O(n)$ (resp. $P\in U(n)$). Therefore $$ \begin{align*} PAP\inv ={}& PA\overline{P}^T \\ ={}& P \pmat{A \overline{\v v_1} & \ldots & A \overline{\v v_n}} \\ ={}& P \pmat{\lambda_1 \overline{\v v_1} & \ldots & \lambda_n \overline{\v v_n}} \\ ={}& (\lambda_j \v v_i^T \,\overline{\v v_j})_{ij} \\ ={}& \pmat{\lambda_1 \\ &\ddots \\ && \lambda_n}. \end{align*} $$