Christmastide was a joyous period long ago. It began at dusk on December 24 and lasted through Epiphany. Twelfth Night, the eve of Epiphany, was a time for masquerade parties, a big feast, and the crowning touch, the Twelfth Night cake. A bean and a pea were traditionally baked into the cake; the man who found the bean was the King of the festivities and the woman who had the pea was the Queen. (Other little tokens were often put into the cake for "fortunetelling" purposes: a thimble symbolizing spinsterhood, a baby indicating the finder would become a parent, etc.) You had to be very careful eating a Twelfth Night cake!
Eventually the Twelfth Night cake because Britain's Christmas cake and Americans fell out of the habit altogether, developing a cookie tradition instead (the word "cookie" is derived from "small cake," so it still holds a bit of the meaning).
Many SCA (Society for Creative Anachronism) groups still celebrate Twelfth Night and often have public gatherings at the time.
"Twelfth Night; or King and Queen"
Now, now the mirth comes
With the cake full of plums,
Where bean's the king of the sport here;
Beside we must know,
The pea also
Must revel, as queen, in the court here.
Begin then to choose,
This night as ye use,
Who shall for the present delight here,
Be a king by the lot,
And who shall not
Be Twelfth-day queen for the night here.
Which known, let us make
Joy-sops with the cake;
And let not a man then be seen here,
Who unurg'd will not drink
To the base from the brink
A health to the king and queen here.
Next crown a bowl full
With gentle lamb's wool:
Add sugar, nutmeg, and ginger,
With store of ale too;
And thus ye must do
To make the wassail a swinger.
Give then to the king
And queen wassailing :
And though with ale ye be whet here,
Yet part from hence
As free from offence
As when ye innocent met here.
Here's a very informative article about Twelfth Night called "The Holiday Time Forgot"
"Fish Eaters" Twelfth Night Page
School of the Seasons Twelfth Night Page
Recipe for King's Cake/Twelfth Night Cake
Shakespeare's "Twelfth NIght"