Why do stars twinkle?
Stars don't flicker on their own — Earth's atmosphere is doing it to them.

1Stars look like they flicker, but starlight itself is extremely steady. Before reaching your eyes, the light must pass through Earth's atmosphere, whose density is uneven and constantly shifting. The light is refracted slightly and its direction wobbles, so we see stars brighten and dim — a phenomenon called scintillation.
2Planets, interestingly, rarely twinkle. Distant stars are mere points of light, easily jumbled by turbulence; planets are much closer and appear as tiny disks, so the turbulence averages out and their light stays steady. Next time you see a bright, rock-steady 'star', it is probably a planet.
3The thicker and more unstable the atmosphere, the stronger the twinkle — which is why observatories are built on high mountains, and why space telescopes, sitting above the atmosphere entirely, see stars that never blink at all.
Twinkling is atmospheric refraction; planets barely twinkle because they are tiny disks, not points.