The concept in astronomy is called seeing—the better the seeing, the clearer (and less twinkly the stars). @sndfreQ is really close—it’s actually thermal diffraction (like heat coming off a road), because the star’s light is coming from such a singular point, the tiniest heat differentials in the atmosphere make things twinkle.
@steve6 you are also correct—the moon tends to light up the atmosphere (at least in lower altitudes & lower humidites), which reduces the contrast of the stars against the sky—I was up at 6000ft on a cool, very dry night—the moon was quite lovely against a nearly black sky.