For $A= (A_1,\cdots,A_d)\in {\cal L}(E)^d$ such that $A_iA_j=A_jA_i$ for all $i,j$. Why $$\sum_{f\in F(n,d)} A_{f}^*A_{f}=\displaystyle\sum_{|\alpha|=n}\frac{n!}{\alpha!}{A^*}^{\alpha}A^{\alpha}\,?$$ Note that $F(n,d)$ denotes the set of all functions from $\{1,\cdots,n\}$ into $\{1,\cdots,d\}$ and $A_f:=A_{f(1)}\cdots A_{f(n)}$, for $f\in F(n,d)$. Also $\alpha = (\alpha_1, \alpha_2,...,\alpha_d) \in \mathbb{Z}_+^d;\;\alpha!: =\alpha_1!\cdots\alpha_d!,\;|\alpha|:=\displaystyle\sum_{j=1}^d|\alpha_j|$; $A^*=(A_1^*,\cdots,A_d^*)$ and $A^\alpha:=A_1^{\alpha_1} A_2^{\alpha_2}\cdots A_d^{\alpha_d}$.
The above formula figures in Remarks. 1. of this paper (1).