Stellar nucleosynthesis

Stellar nucleosynthesis is the creation (nucleosynthesis) of chemical elements by nuclear fusion reactions in stars. This fusion reaction also creates the stars' light and heat. The theory was proposed by Fred Hoyle in 1946. Stars evolve because of changes in what they are made up of throughout their life. However, this does not by itself change the amount of elements in the universe. Later in its life, a low-mass star will slowly release its atmosphere through solar wind, forming a planetary nebula. A high-mass star will release mass through a supernova.
Hydrogen fusion
Hydrogen fusion is the main process that makes energy in main sequence stars. Stars of all masses start on the main sequence. Hydrogen fusion combines four protons, which are hydrogen-1 nuclei, to make a helium-4 nucleus. In doing this, the star must convert two protons into neutrons.
Less massive stars, such as the Sun, use the proton-proton chain reaction. It starts with a collision of two protons. One of them becomes a neutron (after it releases a positively-charged positron). This creates a hydrogen-2 nucleus. Next, it collides with another proton to make a helium-3 nucleus. Finally, two helium-3 nuclei collide. This releases two protons and creates a stable helium-4 nucleus.
More massive stars use the CNO cycle to make helium-4. It starts with a carbon-12 nucleus. Four protons hit it, one at a time. Two of them become neutrons. Then the nucleus splits apart into a helium-4 nucleus and a carbon-12 nucleus, so the cycle can keep going. Of course, this is only possible if there is already carbon-12 in the star.
Helium fusion
Helium fusion combines three helium-4 nuclei into carbon-12. If two helium-4 nuclei collide, the resulting nucleus will decay very quickly. So three helium-4 nuclei must collide at almost the same time.
A helium-4 nucleus is also called an alpha particle, so this process is called the triple-alpha process.
Helium fusion requires higher temperature and pressure than hydrogen fusion. It can happen in all but the smallest stars. Helium fusion starts when the core runs out of hydrogen. When hydrogen fusion stops, the core stops making heat and light. Gravity collapses the core, making it smaller. This creates enough pressure and heat for helium fusion. The helium fusion makes the star much bigger. It becomes a red giant or red supergiant.
Alpha process
In the alpha process, helium-4 nuclei collide with larger nuclei. This creates oxygen, neon, magnesium, and larger elements. It requires higher temperature and pressure than helium fusion. This requirement gets even higher as nuclei get larger. It will not happen in the Sun, but in much more massive stars.
The alpha process creates elements up to iron (atomic number 26). It creates nuclei whose mass numbers are multiples of 4.
S-process and r-process
In the s-process and r-process, large nuclei collide with neutrons. Sometimes, a nucleus will then go through beta decay, and a neutron will change into a proton. The "s" stands for "slow", because it happens more slowly, when less neutrons are nearby. It can happen inside red giant stars. The "r" stands for "rapid", because it happens more quickly, when more neutrons are nearby. The r-process can happen in a supernova. These are an important source of rare, heavy elements.
References
Further reading
Nuclear physics
Astrophysics