A flam is two notes played by both hands so close together that they sound like one thick stroke. The lead hand plays a quiet grace note just before the main hand's full stroke — close enough that you hear "fl-AM" rather than two distinct hits.
Two things make a flam work: height and timing. The lead hand starts low (about two inches from the head); the main hand starts high (six inches or more). Both come down at almost the same instant — the lead hand lands first only because it has less distance to travel. The volume difference is automatic if the heights are right.
The lead hand alternates: a right flam is grace L + main R (the L is the grace because the R is louder); a left flam is grace R + main L. After each flam, your hands are pre-positioned for the next one — the hand that just played the main stroke is now high and ready to be the next main note.
Reading the Notation
The notation below uses real grace notes — the tiny slashed note before each main note is the grace. A lowercase l or r under the grace tells you which hand plays it; the uppercase R or L under the main note is the loud hand. The grace is not on the metronome click — the main note is. Don't try to play the grace "on time"; play it just before time, leaning into the main stroke.