Noncommutative geometry and motives: The thermodynamics of endomotives