The StarTribune provided the explanation:
Diedre Neal, the sixth-grade assistant principal at Alice Deal Middle School in Washington, D.C., started noticing them all over the cafeteria. During lunch, the children, mostly the girls, clapping their hands, beating out a rhythm on upturned plastic cups, then flipping them over and slamming them onto the table. Over and over again. Clap, clap, ba-da-boom, boom, boom, slam. Boom slam. Boom slam.
If they didn’t have cups, the girls hammered out the rhythm with their fists. Neal soon realized the girls weren’t just being just rambunctious — they were all banging out the same pattern, singing the same song: “When I’m gone, when I’m gone, you’re gonna miss me when I’m gone …”
A new hand-clapping game, similar to schoolyard classics such as “Miss Mary Mack” and “Down by the Banks,” was spreading through the school, transmitted from student to student, face-to-face, like in the old days. Inside of a week, the rhythm became ubiquitous.
The flulike spread of “Cups” allowed Neal to experience something that social scientists are just beginning to understand. The games are encoded with sociocultural significance, said Elizabeth Tucker, a folklorist and English professor at Binghamton University in New York.A quick YouTube search yielded the embedded example at top (the best vocal harmony of the many examples available).
They have existed since at least the late 19th century and their functions include teaching dexterity and serving as tools for forming friendships. And new research is showing that these primitive clapping and chanting games have endured around the world, despite competition from hand-held technology.
Addendum: Anna Kendrick performing Cups (Pitch Perfect's "When I'm Gone"). Hat tip to a reader for finding it.