Hydrostatic equilibrium happens when the pull of gravity is balanced by a pressure gradient which creates a pressure-gradient force in the other direction. The balance of these two forces is known as the hydrostatic balance. It flattens the surface of undisturbed liquids.
This short article about physics can be made longer. You can help Wikipedia by adding to it.