Stir sugar into water and it disappears. Pour oil onto water and it floats on top in a separate layer. Whether something dissolves depends on the pulls between its molecules and the liquid's molecules.
When a substance dissolves, its molecules spread out between the molecules of the liquid. Water's molecules hold each other with hydrogen bonds, so to let another molecule in, they have to let go of some of those bonds. That happens easily when the newcomer can make hydrogen bonds of its own.
Sugar: hydrogen bonds all round
Table sugar is sucrose, a glucose ring joined to a second sugar ring, fructose. Like glucose, it is covered in -OH groups: eight of them. Each -OH makes hydrogen bonds with water, so water molecules crowd round each sugar molecule and carry it off into the liquid.
Drag the model to turn it. Pinch to zoom, or use the buttons.
Sugar dissolves very well: a litre of water at room temperature takes up about 2 kg of it.
Oil and water stay apart
Oils and fats are mostly long hydrocarbon chains: a fat molecule is three of them joined to glycerol. Carbon and hydrogen pull on shared electrons about equally, so the chains carry hardly any charge, and they offer water nothing to hold. The water molecules keep their hydrogen bonds with each other and squeeze the oil out. The oil gathers into its own layer, and because it is less dense than water, the layer floats.
Oily substances mix well with each other. Hexane and cooking oil mix in any amount, petrol dissolves grease, and painters clean oil paint off their brushes with white spirit, a mixture of hydrocarbons. Chemists sum it up as like dissolves like. Polar molecules, with δ+ and δ− ends, tend to dissolve in polar liquids such as water, and non-polar molecules such as oils and alkanes in non-polar liquids.
Alcohols: a bit of both
An alcohol has two parts: an -OH group that makes hydrogen bonds with water, and an oily hydrocarbon chain. Methanol, ethanol and propanol have short chains, and they mix with water in any amount. Butan-1-ol, with 4 carbons, dissolves only about 7 g in 100 g of water, and octan-1-ol, with 8, hardly dissolves at all. The longer the oily chain, the less the -OH group can pull the molecule into water. Lesson 14 shows how soap uses a molecule with a water-loving end and a long oily tail.