Solubility is a measure of how well one substance, the solute, dissolves in another substance, the solvent. The identities of both substances, the temperature, and the pressure all affect the solubility of one substance in another. A general rule of thumb is that “like dissolves like.” For example, a nonpolar substance will generally be soluble in other nonpolar substances, but it typically will not mix very well with polar substances. Think of water and oil. Oil, a nonpolar substance, will not mix with water. Instead, the two different substances will form layers, with the denser substance at the bottom. You can temporarily force the two substances to mix by stirring or shaking up the solution, but it will always return to its separate layers.
However, a charged substance, such as the ionic compound NaCl (table salt), can dissolve easily in another polar substance, such as water (H2O). This is because the polar ends of the water molecules are attracted to the ions. The negatively-charged oxygen atom in the water molecule will be attracted to the positively-charged sodium ion. Similarly, the positively-charged hydrogen atom in the water molecule will be attracted to the negatively-charged chloride. The water molecules will therefore be able to pull ions out of the salt. When all of the ions have been pulled apart by the water molecules, the salt has dissolved completely. When there are no more water molecules to pull apart the ions in the salt, the solvent has reached its maximum capacity and is called a saturated solution. Any more solute that is added to the solvent will gather at the bottom and form a precipitate.
A solution can become supersaturated if it is heated. Heat will increase the motion of the solvent's molecules, allowing for more of the solute to be dissolved. However, once the supersaturated solution is allowed to cool down, the extra solute that had been dissolved will once again form a precipitate.