Lottery is a game in which people purchase tickets for a chance to win a prize based on random selection. Prizes may be cash or goods, and there are many different kinds of lotteries. Some are played for entertainment only, while others raise funds for public projects. The first recorded lotteries were organized in the Low Countries in the 15th century to fund town fortifications and help the poor. At the time, they were widely hailed as a painless form of taxation.

People buy lottery tickets because they enjoy the thrill of trying to win and because they believe that their luckiness will increase their wealth, even if the odds are very slim. They also want to know what the winning numbers are, which is why most lotteries publish the results after each drawing.

The purchase of lottery tickets cannot be explained by decision models based on expected value maximization, because the ticket costs more than the expected gain. But it can be explained by a risk-seeking model in which the purchasers have a utility function defined on something other than the lottery results.

The success of a lottery depends on the quality of the prize pool and its distribution. Some of the prize money must go to administrative expenses and profit for the organizer or sponsors, while a percentage goes as state revenues and profits, which can then be used for public services such as education. The remainder can be set aside for prizes, with a preference for large prizes over many smaller ones.