Isotopes form in the sun and other stars. Stars are composed of the simplest elements, hydrogen. Under high temperature and pressure (due to the sun's gravity) two hydrogen atoms are squeezed together which forms slightly larger elements such as helium. Two helium atoms can fuse together to create beryllium. In this manner the smaller elements are fused. These reactions are called fusion reactions and release energy.
The larger isotopes are formed later in the star's life cycle, when most of the fusible material has been consumed. Some very massive stars will undergo a supernova explosion during which the elements and remaining material are forced out, away from the center of the star. Atoms will attract other atoms or other material. A wide variety of isotopes can form during a supernova. Many of the isotopes formed during this process are unstable and will spontaneously change in order to become more stable.
The ChemMatters article referenced explains the process thoroughly. I highly recommend the read. Hope this helps!
Isotopes are formed when a nucleus gains or loses neutrons. This affects only the mass of the atom, NOT the charge of the atom.
There are some elements with many different isotopes, thus their masses will differ. The average atomic mass is displayed at the bottom of each 'element box' in the periodic table. This means that for each element, all of the possible isotopes were averaged.
Some isotopes are stable, and some are unstable. The unstable isotopes form because as the atomic number gets bigger, this means that there are more protons, which in turn, means that there are more neutrons binding the protons together. When there are so many neutrons, the neutrons find it difficult to do their job of binding the protons together, so, they will often 'leave' the atom, thus making them unstable.