A lottery is a game of chance, in which numbered tickets are sold for a prize consisting of money or goods. Lotteries are usually regulated by law. They may be public or private, state-sponsored or commercial, and they can offer multiple prizes, including a single grand prize. People also use the term to refer to any gambling activity that involves a chance element.

Lottery, the name for this game of chance, is so popular that it’s almost a part of everyday vocabulary. We see billboards offering huge payouts for the Mega Millions and Powerball jackpots on our highways, and there’s an inextricable human urge to play.

But what’s going on behind the scenes when we hand our cash to lottery retailers? Where does that money go, and who makes the most profit?

The first recorded lotteries with tickets and prizes were held in the Low Countries in the 15th century. They helped raise funds for town fortifications and for helping the poor. Today, lotteries are widespread and provide a major source of funding for public works projects.

But they also make money by skewing the demographics of players. One in eight Americans buys a ticket each week, and they’re disproportionately lower-income, less educated, nonwhite, or male. They’re also largely playing the same numbers, using all kinds of quote-unquote systems—astrological, numerological, birthday, favourite number, pattern based, and more. And the winnings do add up. But so do the overhead costs of lottery operations.