The crude oil, which is composed of a mixture of different hydrocarbons, is heated in the bottom of the tower, so that hydrocarbons with lower boiling points boil off first. The tower gets gradually colder as you go up, so different hydrocarbons condense at different stages with natural gas at the top, then naphtha, petrol, diesel and eventually bitumen at the bottom. Hydrocarbons with longer chain length have higher boiling points because there is more surface area of the molecules touching eachother meaning the intermolecular forces are stronger and require more energy to break.