Statistical mechanics tries to predict macroscopic properties (e.g. density, melting point, boiling point, elasticity, viscosity, ...) from microscopic properties (molecular interactions) and from the idea that the system shows what is most probable. So for example, for a number of molecules to be in one corner of the system is much less likely than for them to be distributed over the system. This is so because there are many more ways to put the particles all over the system than there are ways to put them in one corner. These “ways” are called microstates, and the fundamental assumption is that all microstates are equally probable. Statistical mechanics then boils down to counting microstates: the scenario with most microstates is most probable, and that’s the one you’ll see.
There are more microstates with molecules distributed over the system, and much more so for very large numbers of molecules. Air in a room has some 10^{23} (!!) particles. You would wait for a long time until it happens that so many particles move all to one corner, although it is possible.* The fact that macroscopic particle numbers are so huge makes the differences in probabilities drastic, and that’s why this approach is successful.
There are fluctuations around a perfectly even distribution (the other extreme), but also these fluctuations become so small with such large numbers that the system has a welldefined density everywhere. To calculate this density under a given set of conditions (microscopic interactions, pressure, temperature) is a task of statistical mechanics, and carrying on with these ideas gets you to other macroscopic properties as well  at least in principle.
In practice such calculations are not easy. To derive a formula for the density from particle properties and pressure and temperature is impossible except for idealized cases. To do a computer simulation (so you get at least a number for the density for one set of conditions) with 10^{23} particles is definitely impossible. Theorist and simulator therefore work with idealizations, and the simulator uses only 10^{4} or so particles (depending on how sophisticated the model is).
* Do not try this at home.
