The twinkling of stars in our night sky is down to the Earth's atmosphere. As light from the stars travels towards Earth it can easily move in a straight line, but once it starts travelling through the Earth's atmosphere it gets bounced around in different directions by the particles in the air. This is because refraction.