If you are in the outer space, they don't. Stars shine like how the Sun does, it doesn't twinkle. They just give off light continually.
However if you see the stars from the earth, they seem to twinkle. This happens because when the light from a star reaches the earth's atmosphere, it gets refracted (bent) because of the many layers it passes through before it reaches our eyes.