To understand why things dissolve at all, we will look at the solution formation process from a thermodynamic point of view. shows a thermodynamic cycle that represents the formation of a solution from the isolated solute and solvent. From Hess's law we know that we can add the energies of each step in the cycle to determine the energy of the overall process. Therefore, the energy of solution formation, the enthalpy of solution, equals the sum of the three steps--ΔHsoln = ΔH1 + ΔH2 + ΔH3.
ΔH1 and ΔH2 are both positive because it requires energy to pull molecules away from each other. That energy cost is due to the intermolecular forces present within any solute or solvent. The forces acting between molecules such as CH3Cl are largely van der Waals and dipole-dipole interactions. Some molecules that contain O-H, N-H, or F-H bonds can form hydrogen bonds that are relatively strong intermolecular forces. Ions of opposite charge, such as in a crystal of NaCl, are attracted to each other because of electrostatic forces. Each of those forces increase with decreasing distance. Therefore, it should make sense that it costs energy to pull molecules and ions away from each other. When the expanded form of the solvent and the solute are combined to form a solution, energy is released, causing ΔH3 to be negative. This makes sense because the solute and solvent can interact through the various types of intermolecular forces.
What determines the enthalpy of solution is, therefore, the difference between the energy required to separate the solvent and solute and the energy released when the separated solvent and solute form a solution. To restate that in simpler terms, solutions will form only when the energy of interaction between the solvent and solute is greater than the sum of the solvent-solvent and solute-solute interactions. That situation can only occur when the solvent and solute have similar properties. For example, if a non-polar molecule, such as oil, is mixed with a polar molecule like water, no solution forms. Water's solvent-solvent intermolecular interactions are mostly hydrogen bonds and dipole-dipole while oil has only van der Waals. Water can satisfy its hydrogen bonds and become stabilized by dipole-dipole interactions only when near other water molecules. Therefore, water is destabilized when it forms a solution with oil. That is why such a solution will never form between oil and water. Therefore, the primary rule of solubility is that like dissolves like. Only when the solute and solvent molecules have several common structural features such as their polarities will a solution form.
If you have not yet studied thermodynamics or you do not know what ΔG or ΔS stands for, then please skip to the next heading in which the following discussion on temperature and pressure effects on solubility is summarized without the thermodynamics. The following discussion is a slightly more advanced treatment of the same phenomena.
The creation of disorder during the solution formation process is its essential driving force. In fact, most compounds that are soluble in water have positive enthalpies of solution. The only reason why those solutions form is due to the positive entropy of solution, ΔSsoln. As shows, both the solvent and the (solid or liquid) solute become less ordered upon solution formation. Therefore, from the equation ΔG = ΔH - TΔS we should predict that the solubility of every compound should increase with increasing temperature. That prediction turns out to be correct for nearly every solvent and solute. However, there are some exceptions, such as sodium sulfate in water that actually become less soluble at higher temperatures. That is usually due to their negative entropies of solution. The reason why some solutions have a negative entropy of solution is beyond the scope of this SparkNote. If you wish to pursue this topic further, search for the hydrophobic effect.
Using the idea of the entropy of solution, we can predict other properties of solutions. For example, we should predict that all gasses should bcome less soluble in water with increasing temperature because they have a negative entropy of solution. Gasses have a negative entropy of solution in water because they are confined to a smaller volume when dissolved as compared to their volumes as gasses. As we should predict, all gasses become less soluble in water with increasing temperature.