The major factor affecting solubility is intermolecular forces.
To form a solution we must:
1. Separate the particles of the solvent.
2. Separate the particles of the solute.
3. Mix the particles of solvent and solute.
#ΔH_("soln") = ΔH_1 + ΔH_2 + ΔH_3#
#ΔH_1# and #ΔH_2# are both positive because it requires energy to pull molecules away from each other against the intermolecular forces of attraction. #ΔH_3# is negative because intermolecular attractions are forming.
For the solution process to be favourable, #ΔH_3# should at least equal #ΔH_1 + ΔH_2#.
If both solvent and solute are nonpolar, all the #ΔH# values are small. The major factor then is the increase in entropy (disorder) that occurs when a solution forms. This is a favourable process.
If both solvent and solute are polar, all the #ΔH# values are large but similar in size. The major factor again is the increase in entropy.
LIKE DISSOLVES LIKE.
If a nonpolar solute such as oil mixes with a polar solvent like water, #ΔH_1# is large and positive. This outweighs #ΔH_3#. A solution does not form.