Oil and water do not dissolve with one another. They naturally separate because of their different densities. Simply leaving an oil and water mixture in an undisturbed state allows the two liquids to separate themselves. Other laboratory methods of separating oil and water include freezing or boiling the mixture or adding a soluble ionic salt.
Changing the state of the water to either a gas or a solid is a means to cleanly remove all of the oil from the water. Boiling the mixture eliminates the water by turning it into a gas. Boiling affects the water and not the oil because oil has a lower vapor pressure than water.
Likewise, freezing the mixture pushes any oil molecules out of the water when the water molecules bond more closely with one another, eliminating any space for stray oil molecules. After it is frozen, the frozen water can be separated from the still-liquid oil, which has a lower freezing point.
To remove the water from the oil, add a soluble ionic salt such as Epsom salts to the mixture. Adding the salt to the oil makes it less soluble and coagulates any stray oil molecules in the water section, allowing for easy removal.