At the heart of a massive star the force of gravity is so great hydrogen atoms are forced together. This causes a nuclear reaction called fusion, wherein hydrogen atoms fuse together to form helium. Helium forms a central core, the fusion reaction continuing to take place at the core's surface. This reaction gives off an enormous amount of energy in the form of heat and light, which is radiated outwards from the core where the reaction is taking place. When a balance between the outwards gas pressure and gravity pulling inwards is reached, the stage is called equilibrium. Stars live most of their lives in this sequence.
Hydrogen continues to fuse into helium at the surface of the inner core, which is now hot burning helium. Eventually gravity is so great and the helium so dense that it, in turn, starts fusion reactions within the core of the star. Heavier elements of carbon and oxygen are born, and these move towards the center of the star forming a second core. The energy created during this reaction is greater than the pull of gravity, and so the star swells, taking more space and becoming less dense and cooler. A red giant is born.
The fusion of hydrogen into helium continues to take place at the surface of the helium core, which gradually moves outwards. Because of the massive gravity at the center of the star, carbon and oxygen start fusing together to form Iron and other heavy elements. However, these reactions absorb energy rather than giving off energy. Outward pressure ends abruptly. Equilibrium is broken, and gravity takes over, the inward pressure crushing the core.
The collapse of the core causes a massive shock wave, which blows away the outer layers of the star in a huge explosion called a supernova. One of two things can happen to the core of the star. If its mass is less than about 15 times the mass of the sun, electrons are forced into their protons to form neutrons, and a neutron star is born with a diameter of about 20 km. If the remains of the core is 15 times the mass of the sun or greater, then it will continue to collapse under its own gravity to form a black hole.