Esters can be formed by reacting alcohols with carboxylic acid and acid anhydride
This reaction is reversible so is removed by distillation
To purify the ester you add sodium carbonate solution
The top layer is the ester and can be removed through a filter funnel