Many students have wondered, "If protons are all positively charged, why do they stay together in atomic nuclei?" The interactions between protons and neutrons can produce stable conditions in which the electrostatic repulsion is balanced by an attractive nuclear force. When these conditions are not met, there is a chance that the atomic nucleus will eject particles to move to a lower energy state.
When protons and neutrons are under extreme temperature and pressure, they have a chance to fuse together into new atomic nuclei. In the process, some of their mass is converted into energy using Einstein's famous energy-mass equivalence formula: E = mc^2. This energy is released into the surroundings. This fusion process is the mechanism by which stars "burn" their fuel.