Stars (except for the Sun) appear as tiny dots in the sky; as their light travels through the many layers of the Earth's atmosphere, the light of the star is bent (refracted) many times and in random directions (light is bent when it hits a change in density - like a pocket of cold air or hot air). This random refraction results in the star winking out (it looks as though the star moves a bit, and our eye interprets this as twinkling).
Stars do not really twinkle, they just appear to twinkle when seen from the surface of Earth. The stars twinkle in the night sky because of the effects of our atmosphere. When starlight enters our atmosphere it is affected by winds in the atmosphere and by areas with different temperatures and densities. This causes the light from the star to twinkle when seen from the ground.