A lottery is a form of gambling in which numbers are drawn to win prizes. People who buy tickets pay for a chance to win, and the winners are determined by luck. Often, the winnings are paid out in cash. Many governments use lotteries to raise money and help needy people. In the US, people spend billions on lottery tickets each year. The lottery is not the only way to gamble, but it is one of the most popular.

The term also refers to a method of selecting or assigning things by lot, such as units in a subsidized housing complex or kindergarten placements in a public school. In sports, the NBA holds a lottery to determine draft picks. The team with the worst record gets first choice, and then the odds for each remaining team decline until the 14th-ranked team, a.k.a. the New Orleans Pelicans, has a 0.5% chance of getting the first pick.

The first European lotteries were probably held in the 15th century, with towns raising money for walls and town fortifications, as well as helping the poor. These were private lotteries, but Francis I of France approved public lotteries in several cities. In modern lotteries, applications are thoroughly mixed by mechanical means (such as shaking or tossing), then the winning numbers and symbols are selected in a drawing. The drawing may be done manually, but computers are used more and more often, for their ability to store information about large numbers of entries and generate random numbers. The prize pool for each draw must be calculated, including costs for organizing and promoting the lottery, and the percentage of the prize pool awarded to winners must be decided.