Stars shine due to nuclear fusion in their cores. In this process, hydrogen converts into helium through extremely hot thermonuclear reactions and colossal pressures.
These reactions release an immense amount of energy in the form of electromagnetic radiation, including visible light. This radiation radiates into space, causing the stars to shine brightly.
The temperature and mass of a star determine its color and brightness; hotter stars tend to appear more white or blue, while cooler ones appear red.
Gravity maintains this delicate balance of forces in a star for millions or even billions of years.