I am interested in studying equidistribution of Hecke eigenvalues and proving statistical properties of arithmetical objects. On the road, I face the following problem: how to express sums of the form
$$\sum_{c(\pi)<X} a_n(\pi)$$
where $a_n(\pi)$ is the $n$-th coefficient of the Dirichlet series defining $L(s, \pi)$, and $c(\pi)<X$ is some truncating condition. The sum is over irreducible representations of a totally definite quaternion algebra $Z\backslash B^\times$. We know that those coefficients can be read as Hecke eigenvalues $\lambda_n(\pi)$, so I am thinking in applying trace formulas to Hecke operators in order to reach such a sum, as in Serre's article on equidistribution.
In simple cases, such as compact groups, I can use the Selberg's trace formula, and it remains to find a suitable test-function in order to reach those coefficients/eigenvalues. Is there a standard approach, and if so are there easy ways to make those eigenvalues appear in the spectral side of the trace formula ?
More generally, what are the common relations between trace formulas and Hecke operators (I suppose it is a fertile ground, for both Hecke eigenvalues and trace formulas are powerful tools, and both are "spectral" objects) ?
Any idea or reference would be of great help !