The Madelung synthesis is based on the formation of a benzylic carbanion that cyclizes on an amide substituent.

Mechanism:
Step 1. Deprotonation of the amide

Stage 2. Deprotonation of the benzylic position

Stage 3. Cyclization.

Stage 4. Aqueous acid treatment

Stage 5. Loss of water
