[step:Apply induction on each preserved eigenspace]
For each $1\le j\le r$, define
\begin{align*}
A_j:=\{g|_{E_j}:E_j\to E_j\mid g\in A\}.
\end{align*}
Because each $g\in A$ preserves $E_j$, this is a well-defined set of linear maps on $E_j$. Since $g\in U(n)$ preserves the standard Hermitian inner product on $\mathbb C^n$ and satisfies $g(E_j)=E_j$, the restriction $g|_{E_j}:E_j\to E_j$ preserves the inherited Hermitian inner product on $E_j$. Thus every element of $A_j$ is unitary on $E_j$. If $g,h\in A$, then
\begin{align*}
(g|_{E_j})(h|_{E_j})=(gh)|_{E_j},
\end{align*}
and $gh\in A$ because $A$ is a subgroup, so $A_j$ is closed under composition. The identity element of $A_j$ is $I_n|_{E_j}:E_j\to E_j$, which is the identity map on $E_j$, because $I_n\in A$. If $g\in A$, then $g^{-1}\in A$ and $g^{-1}(E_j)=E_j$, so the inverse of $g|_{E_j}:E_j\to E_j$ is $g^{-1}|_{E_j}:E_j\to E_j$. Therefore $A_j$ is a subgroup of the unitary group $U(E_j)$ of the Hermitian space $E_j$. It is abelian because $A$ is abelian.
Let $m_j:=\dim E_j$. Choose a unitary isomorphism $\Phi_j:\mathbb C^{m_j}\to E_j$. Conjugating by $\Phi_j$ identifies $A_j\le U(E_j)$ with the abelian subgroup
\begin{align*}
\Phi_j^{-1}A_j\Phi_j\le U(m_j).
\end{align*}
We have $1\le m_j<n$, so the induction hypothesis applies to $\Phi_j^{-1}A_j\Phi_j\le U(m_j)$. Transporting the resulting basis through $\Phi_j$, there exists an orthonormal basis
\begin{align*}
(b_{j,1},\dots,b_{j,m_j})
\end{align*}
of $E_j$ such that every operator $g|_{E_j}$ with $g\in A$ is diagonal in this basis. Equivalently, for every $g\in A$ and every $1\le k\le m_j$, there exists $\lambda_{j,k}(g)\in U(1)$ such that
\begin{align*}
g b_{j,k}=\lambda_{j,k}(g)b_{j,k}.
\end{align*}
[/step]