Thermodynamics: Counting Microstates, the Partition Function, and Boltzmann Equation