Why does oil not mix with water?
Basically because water is much more polar than oils.
Water molecules are highly polar, with an electronegative oxygen atom pulling charge away from two hydrogen atoms, and creating a molecule with a partial negative charge at one end and partial positive charges at the other.
Oil molecules do not have this property. Some oils may have some polar groups in the molecules but the majority of the molecule will be strings of carbon atoms which means that polarity is low.
It means that it is energetically favourable for water molecules to associate with each other rather than to associate with oil molecules. Similarly it is energetically favourable for oil molecules to associate with each other rather to associate with water.
Net result - two layers.
On the other hand, mix oil together with something like hexane....much better mixing - because both are non polar.