The Cohen-Lenstra heuristics for class groups of number fields, defined in the eighties, and their more recent adaptation by Delaunay to the Tate-Shafarevich groups of elliptic curves, allow to give precise predictions on the behavior of these groups. By using combinatorial methods related to the theory of integer partitions and Hall-Littlewood symmetric functions, we prove a formula for the moments (related to the averages coming from the Cohen-Lenstra heuristics model) of the orders of finite abelian p-groups. This formula, together with the heuristics philosophy, allow us to give precise predictions on class groups (resp. Tate-Shafarevich groups and Selmer groups) for some families of number fields (resp. elliptic curves). In the case of Tate-Shafarevich groups, these conjectures are consistent with the recent model developped by Poonen and Rains on Selmer groups of elliptic curves. Moreover, by combining the probabilistic model with our results, we obtain combinatorial identities which seem to be new, although they are related in some special cases to the theory of Hall-Littlewood polynomials. In some sense, our approach therefore gives for these identities a somehow natural algebraic context. This talk is based on a joint work with Christophe Delaunay (Besancon, France).