Stars are primarily made of hydrogen and helium, with trace amounts of other elements such as carbon, oxygen, and nitrogen. The intense heat and pressure in the core of a star cause nuclear fusion reactions that convert hydrogen into helium, releasing energy in the form of light and heat.