The twinkling of stars is an effect of atmospheric conditions on the refraction of light. Here are the reasons:
i. Stars are point sources of light as they are very far away from us.
ii. The apparent position of the star is slightly higher than its actual position due to the refraction of starlight from the atmosphere. The starlight travels from rarer medium to denser medium and continuously bends towards the normal.
iii. Due to the motion of atmospheric air and change in density and temperature, the atmosphere is not steady. As a result refractive index of air in given region changes continuously and randomly.
iv. Hence, the apparent position of the star and its brightness are not stationary but change slightly.
v. In this way, due to changes in the refractive index of the atmosphere, the stars appear to twinkle at night.