To work out the structure of the ester formed when an alcohol reacts with a carboxylic acid, it is easiest to first draw the structures of alcohol and acid and then remove the H₂O to see what is left when the molecules join.
For example, propan-1-ol and ethanoic acid react together to form propyl ethanoate and water.
propan-1-ol + ethanoic acid → propyl ethanoate + water
CH₃CH₂CH₂OH (l) + CH₃COOH (l) → CH₃COOCH₂CH₂CH₃ (l) + H₂O (l)
The displayed formula for esters is typically written to show the part which came from the carboxylic acid on the left:
This is still called propyl ethanoate: the alcohol bit of the name (propyl) comes first and then the carboxylic acid bit (ethanoate), even though the displayed formula is typically written the other way around. Notice that the structural formulae for esters is also typically written with the carboxylic acid bit first, so propyl ethanoate is CH₃COOCH₂CH₂CH₃.