Comparing Selberg and Eichler-Selberg trace formulas The trace formula of Selberg gives an equality between trace of Hecke operators (a spectral sum) on spaces of Maass forms and sums over closed geodesics mostly. The Eichler-Selberg trace formula, however, gives an identity between trace of Hecke operators on spaces of modular forms and sums over class numbers (or Kloosterman sums).
Are they both related or, rather, both complementary and we need both to have a full spectral picture (of what? a whole trace of Hecke operators?)
More specifically, how can both be made close/comparable? Can we for instance have a version of Selberg's trace formula where the geometric/arithmetic side is written as sum of some class numbers, or other arithmetic invariants?
 A: Trace formulas, and in particular the Selberg trace formula, is an identity $I(f) = J(f)$ of spectral and global distributions where $f$ is a test function.  There are different ways to use the trace formula, e.g., you can look at the trace formula for suitably nice $f$ without actually specifying it, or pick a specific test function $f$ and see what both sides tell you.
The Eichler-Selberg trace formula is a specialization of the Selberg trace formula for a specific $f$ that picks out traces of Hecke operators on holomorphic modular forms.  E.g., see Zagier's article for a derivation in level 1 (well, if you want to follow the proof, see also Zagier's correction).
As for your second question, Hejhal wrote down a fairly general Selberg trace formula for congruence subgroups, and there are some number theoretic functions involved, but it's not nearly as explicit as it can be if you choose a nice test function (e.g., no evident class numbers)  If you're interested in Maass forms, see this work of Conrey and Li for non-holomorphic analogue of Eichler-Selberg, where class numbers do appear, though not as simply as in the holomorphic case.
