More generally, what are the necessary and sufficient conditions for matter to clump into heavenly bodies? I don't know, but I'll guess. It seems sufficient to have particles that attract one another but don't actually merge. Let's focus on two particles. The attraction between the particles acts like a spring which absorbs energy. As for necessary, there has to be some way that particles influence one another to get rid of kinetic energy relative to one another.