It’s a pretty cool reaction where you end up making Mannich bases, which are beta-amino-carbonyl compounds. The reaction involves acetaldehyde, primary or secondary amines (or ammonia), and a carbonyl compound with an acidic proton adjacent to it.
The mechanism is simple, and based on the many proton losses and additions (via the equilibrium between each step), the reaction seems to take place in mildly acidic conditions? The first thing to occur is nucleophilic addition of the amine to acetaldehyde, and subsequent proton transfers leads to an iminium ion. Protonation of the carbonyl compound (shown in red) and tautomerization to the enol form allows the carbonyl compound to attack the iminium ion. Deprotonation of the oxonium ion leads to the final product, a Mannich base.
Formation of the iminion ion:
So how cool is this? You get a compound that has sort-of-opposite functionalities: an electrophilic area (the carbonyl) and a nucleophilic component (the amine). The Mannich reaction has been used for the synthesis of many natural compounds, such as peptides, nucleotides, and antibiotics. It is also utilized in making medicinal compounds, such as Prozac (a single Mannich reaction) and methamphetamine (double Mannich reaction).