There are a number of different processes (thermonuclear fusion) which make stars produce light, heat and energy. The most common happens when four hydrogen atoms combine into a helium atom. This releases energy, which is converted to light and heat.
Eventually, most of the fuel, hydrogen, is exhausted. As the fuel begins to run out, the strength of the thermonuclear fusion reaction declines. Soon (relatively speaking), gravity will win and the star will collapse under its own weight. At that time, it becomes what is known as a white dwarf. As the fuel further depletes and reaction stops all together, it will collapse further, into a black dwarf. This process can take billions and billions of years to complete.