Hydrogen atoms and helium atoms make up the majority of a star's material, existing in a plasma state. The plasma state is similar to a gas state, but with heavily charged ions. The process of ionization refers to the charging of these ions. The internal heat of a star facilitates this ionization, creating a continual system. The star recycles most of its energy for the ionization process. Plasma lacks a definite shape or volume.
The tremendous mass of a star creates gravity, continually crushing the star's own plasma back into its center. The continual crushing of plasma creates an internal friction within the star that produces heat. The internal temperature of a star is far higher that the temperature at its surface as a result. For example, the sun has a surface temperature of 5800 Kelvin, and an internal temperature of up to 15 million Kelvin.
Nuclear fusion occurs due to a combination of intense core temperature and the pressure from the internal gravity of the star. This process of nuclear fusion forces the hydrogen atoms to combine and become helium atoms. The process of nuclear fusion takes many stages to complete and requires considerable time.
Nuclear fusion creates gamma rays. Gamma rays move towards the surface of a star, taking up to 100,000 years to travel from the core to the surface. As they travel, a combination of internal gravity pulls them inward, and a buildup of internal pressure works to direct their energy outward.
Gamma rays lose energy as they move inside the star. This happens because atoms absorb the gamma rays and then emit them again. This loss of energy eventually turns the gamma rays into visible light particles called photons. The release of the visible light photons at the surface of the star, is the actual light that you see at night. Photons continue moving forever after they leave the surface of the star, until they come into contact with another substance.