Main sequence stars have a nearly constant luminosity. (During the next five billion years, the Sun's luminosity will double; that's an increase of only 0.02% every million years.)
By contrast, some giants and supergiants have luminosities which regularly increase and decrease. The period of the luminosity fluctuations (that is, the time between peaks in the brightness) can range from a few hours to a few years.
The two most interesting types of variable star are Cepheid variables and RR Lyrae variables.
Cepheid variables are named after the star Delta Cephei, the fourth brightest star in the constellation Cepheus. The luminosity of Delta Cephei varies by a factor of two, with a period of 5 days. Polaris, the North Star, is also a Cepheid.
Cepheid variables have the following properties:
The fluctuations about the average luminosity can be large (as in the case of Delta Cephei) or small (as in the case of Polaris, where the fluctuations are too small to be detected with the naked eye.
RR Lyrae variables are named after the star RR
Lyrae, in the constellation Lyra.
RR Lyrae stars have the following properties:
RR Lyrae variables thus have shorter periods and lower luminosities than Cepheid variables.
The variation in the luminosity of RR Lyrae and Cepheid stars results from the fact that they pulsate in and out. The radius of a Cepheid can vary by as much as 10\%. (Remember that a giant or supergiant star such as a Cepheid or RR Lyrae variable has a small dense core and a large, low-density envelope. In the case of a Cepheid or RR Lyrae variable, it is only the envelope which expands and contracts. The core remains constant in size, and continues to produce energy at a steady rate.) As the envelope expands and contracts, its surface temperature varies by as much as 1000 degrees Kelvin.
Because the radius R and surface temperature T
change, so does the luminosity L. Remember,
L = 4 pi R2 sigma T4
The textbook has a rather involved description involving the properties of a layer of ionized helium in the star's envelope. A simpler, stripped-down explanation goes something like this:
This cycle repeats as long as the Cepheid (or the RR Lyrae, which pulsates by the same mechanism) is in the instability strip, the region of the H-R diagram where stars are unstable to pulsation.
It was discovered empirically in 1916, by the Harvard astronomer Henrietta Leavitt, that a Cepheid's period of pulsation is linked to its luminosity. (This was long before anyone knew WHY Cepheids varied in luminosity.) Miss Leavitt was studying Cepheid variables in the Large Magellanic Cloud (a nearby galaxy) when she discovered that the brightest Cepheid variables in the galaxy had the longest period of pulsation. This relation holds true in our own galaxy too, and in all other galaxies where Cepheid variables have been detected.
High Luminosity, Long Period.
For instance, a very luminous Cepheid, with L =
40,000 Lsun, has a very long period, P = 60 days. On
the other hand, the dimmest Cepheids, with L = 300 Lsun,
have short periods, P = 2 days. A plot of the period-luminosity
relation for Cepheid variables (as well as for RR Lyrae
variables) is shown below:

(A complicating factor: There are two types of Cepheids. In
addition to the standard Type I Cepheids that I've been
discussing, regions of the universe which have few heavy elements
give rise to a different species of Cepheid: Type II. Type II
Cepheids, because they have a different chemical composition,
have a different period-luminosity relationship.)
Because Cepheids are so luminous, they can be seen to large distances. Parallaxes can be used to determine distances to 500 parsecs or so. However, the period-luminosity relation can be used to determine the distance of a Cepheid about 40 MILLION parsecs away. This lets us find the distance to all the galaxies in our neighborhood. (At least all the galaxies which contain Cepheid variables - Cepheid stars are rare, and must be hunted for carefully.)
The galaxy M100 is 17 million parsecs (56
million light years) away -- 25 times farther than the Andromeda
galaxy. The distance to M100 was determined from the bright
Cepheid stars within the galaxy, which are visible using the
Space Telescope. Click on the image of M100 below, and you will
see six snapshots of an extremely luminous Cepheid in that
galaxy, varying with a period of 51 days.
(Image credit: J. Trauger, [Jet Propulsion Laboratory], &
NASA)
Cepheid variables are a vital tool for measuring the distances of relatively nearby galaxies (out to about 40 million parsecs, or 130 million light years). RR Lyrae stars can also be used to measure distances, but since they are less luminous, they can only be seen to smaller distances.