  In this article we develop a broad generalization of the classical
Bost-Connes system, where roots of unit are replaced by an algebraic datum
consisting of an abelian group and a semi-group of endomorphisms. Examples
include roots of unit, Weil restriction, algebraic numbers, Weil numbers, CM
fields, germs, completion of Weil numbers, etc. Making use of the Tannakian
formalism, we categorify these algebraic data. For example, the
categorification of roots of unit is given by a limit of orbit categories of
Tate motives while the categorification of Weil numbers is given by
Grothendieck's category of numerical motives over a finite field. To some of
these algebraic data (roots of unity, algebraic numbers, Weil numbers, etc), we
associate also a quantum statistical mechanical system with several remarkable
properties, which generalize those of the classical Bost-Connes system. The
associated partition function, low temperature Gibbs states, and Galois action
on zero-temperature states are then studied in detail. For example, we show
that in the particular case of the Weil numbers the partition function and the
low temperature Gibbs states can be described as series of polylogarithms.
