As stated in the introduction to population genetics, the Hardy-Weinberg Law states that under the following conditions both phenotypic and allelic frequencies remain constant from generation to generation in sexually reproducing populations, a condition known as Hardy-Weinberg equilibrium.
A population must be large enough that chance occurrences cannot significantly change allelic frequencies significantly. To better understand this point, consider the random flipping of a fair coin. The coin is as likely to land on heads as it is on tails. If a coin is flipped 1000 times, it is likely to land on heads almost exactly 50% of the time. However, as you may know from experience, if the same coin is flipped only ten times, it is much less likely that it will land on heads 5 times. The same holds true for allele distributions in populations. Large populations are unlikely to be affected by chance changes in allele frequencies because those chance changes are very small in relation to the total number of allele copies. But in small populations with fewer copies of alleles, chance can greatly alter allele frequencies. In small populations, a change in allelic frequencies and phenotypes based on random occurrences is called genetic drift.
In order for allelic frequencies to remain constant, there must be no change in the number of copies of an allele due to mutation. This condition can be met in two ways. A population can experience little or no mutation. Alternatively, it can experience balanced mutation. Balanced mutation occurs when the rate at which copies of a given allele are lost to mutation equals the rate at which new copies are created by mutation.
For allelic frequencies to remain constant in a population, individuals must not move in and out of that population. Whenever an individual enters or exits a population, it takes copies of alleles with it, changing the overall frequency of those alleles in the population.
In order for all alleles to have an equal chance of being passed down to the next generation, mating within the population must be random. Non-random mating can give an advantage to certain alleles, allowing them to be passed down to more offspring than other alleles, increasing their relative frequency in the population. The processes of natural selection, since they usually select for individuals with greatest fitness for a given environment, usually work against random mating: the most fit organisms are most likely to mate.
Just as mating must be random, the survival of offspring to reproductive age, or reproductive success, must also be random. Again, natural selection usually works against such randomness.