Hydride reagents such as LiAlH4 and NaBH4 behave like hydride nucleophiles (H-), so that's what I used as shorthand. The real mechanism is very similar but involves aluminum coordinating to the oxygen.
Notice that the the ester will reform the carbonyl after the first hydride attacks. This is because esters have a built in leaving group, and so undergo nucleophilic acyl substitution reactions. The aldehyde that forms then undergoes a nucleophilic acyl addition reaction with the second equivalent of hydride.
Also note that you can't stop the reaction halfway at the aldehyde- LiAlH4 will take an ester all the way down to an alcohol.