The nucleus (atomic nucleus) is the center of an atom. It is composed of one or more protons and zero or more neutrons. The number of protons in an atomic nucleus is called the atomic number, and determines which element the atom is (for example hydrogen, carbon, oxygen, etc.). The number of neutrons determines the isotope of the element. The numbers of protons and neutrons in a nucleus are correlated; in light nuclei they are approximately equal, while heavier nuclei have a larger number of neutrons. The two numbers together determine the nucleid (type of nucleus). Protons and neutrons have nearly equal masses, and their combined number, the mass number, is approximately equal to the atomic mass of an atom. The mass of the electrons is small in comparison to the mass of the nucleus.
The radius of a nucleon (neutron or proton) is of the order of 1 fm (femtometre). The nuclear radius, which can be approximated by the cubic root of the mass number times 1.2 fm, is less than 0.01 % of the radius of the atom. Thus the density of the nucleus is more than a trillion times that of the atom as a whole. For example, the density of a gold nucleus is such that one solid cubic millimetre of gold nuclei would have a mass of around 200 000 tonnes.
Though the positively charged protons exert a repulsive electromagnetic force on each other, the distances between nuclear particles are small enough that the strong interaction (which is stronger than the electromagnetic force but decreases more rapidly with distance) predominates. (The gravitational attraction is negligible, being a factor 1036 weaker than the electromagnetic repulsion.)
The discovery of the electron was the first indication that the atom had internal structure. This structure was initially imagined according to the "raisin cookie" or "plum pudding" model, in which the small, negatively charged electrons were embedded in a large sphere containing all the positive charge. Ernest Rutherford and Marsden, however, discovered in their famous 1911 gold foil experiment that alpha particles from a radium source were sometimes scattered backwards from a gold foil, which led to the acceptance of the Bohr model, a planetary model in which the electrons orbited a tiny nucleus in the same way that the planets orbit the sun.
A heavy nucleus can contain hundreds of nucleons (neutrons and protons), which means that to some approximation it can be treated as a classical system, rather than a quantum-mechanical one. In the resulting liquid-drop model, the nucleus has an energy which arises partly from surface tension and partly from electrical repulsion of the protons. The liquid-drop model is able to reproduce many features of nuclei, including the general trend of binding energy with respect to mass number, as well as the phenomenon of nuclear fission.
Superimposed on this classical picture, however, are quantum-mechanical effects, which can be described using the nuclear shell model, developed in large part by Maria Goeppert-Mayer. Nuclei with certain numbers of neutrons and protons (the magic numbers 2, 8, 20, 50, 82, 126, ...) are particularly stable, because their shells are filled.
Since some nuclei are more stable than others, it follows that energy can be released by nuclear reactions. The sun is powered by nuclear fusion, in which two nuclei collide and merge to form a larger nucleus. The opposite process is fission, which powers nuclear power plants. Since the binding energy per nucleon is at a maximum for medium-mass nuclei (around iron), energy can be released both by fusing light nuclei or by fissioning heavier ones.
The elements up to iron are created in a star during a series of fusion stages, such as the proton-proton chain, the CNO cycle and the triple-alpha process. Progressively heavier elements are created during the evolution of a star. Since the binding energy per nucleon peaks around iron, energy is only released in fusion processes occurring below this point. The creation of heavier nuclei costs energy, and therefore these are predominantly created during supernova explosions, in which enormous amounts of energy are released.
Nuclear reactions occur naturally on Earth, and are in fact quite common. These include alpha decay and beta decay, and heavy nuclei such as uranium may also undergo fission. There is even one known example of a naturally occurring fission reactor, which was active in Oklo, Gabon, Africa around 2 million years ago. 
Much of current research in nuclear physics relates to the study of nuclei under extreme conditions such as high spin and excitation energy. Nuclei may also have extreme shapes (similar to that of american footballs) or extreme neutron-to-proton ratios. Experimenters can create such nuclei using artificially induced fusion or nucleon transfer reactions, employing ion beams from a accelerator. Beams with even higher energies can be used to create nuclei at very high temperatures, and there are signs that these experiments have produced a phase transition from normal nuclear matter to a new state, the quark-gluon plasma, in which the quarks mingle with one another, rather than being segregated in triplets as they are in neutrons and protons.