A lottery is a contest in which winners are chosen at random. Prizes may be cash or goods. Traditionally, the lottery has been used to finance public projects like road construction and other infrastructure. More recently, however, governments have also used it to provide education and health services. Unlike most other games of chance, the lottery does not require skill or knowledge to win. Rather, it relies on luck and the whim of the gods.

The first essential element of any lottery is a mechanism for collecting and pooling all money staked as bets. This is usually accomplished by a hierarchy of sales agents who pass the money paid for tickets up through the organization until it is banked. A second necessary element is a procedure for selecting winning numbers or symbols. Typically, the pool of tickets or their counterfoils is thoroughly mixed by some mechanical means—like shaking or tossing—before a winner can be selected. This process is meant to ensure that chance, and not a bias or other consideration, determines the winning ticket. Computers are often used to perform this function because they have the capacity to store information about large numbers of tickets and to generate random selections.

Almost all state lotteries follow a similar pattern: they establish a monopoly for themselves (by law, or through licensing a private company in return for a cut of the profits); start out with a modest number of relatively simple games; and then gradually expand their operations as the need for additional revenue drives them to do so. While making the game accessible to a wide range of the population is important, it is also helpful for lotteries to attract specific constituencies. Among these are convenience store operators; suppliers who receive discounts on the cost of selling tickets; teachers in states that earmark lottery revenues for education; and the political class, which quickly becomes accustomed to the extra tax revenues that result from the lottery.