The infinite monkey theorem is a theorem which suggests that if you put a hypothetical monkey in front of a typewriter for an infinite period of time, the monkey will eventually generate the complete works of William Shakespeare. This theory is often referenced in popular culture, and some mathematicians have even attempted analysis to determine whether or not the theory holds true. According to their calculations, Shakespeare need not fear for his reputation; the probability of such an event is very, very close to zero.
You may hear the infinite monkey theorem stated in a number of ways. For example, people may say that the number of monkeys is infinite, and the period of time is unspecified. Shakespeare may also find himself replaced with other notable authors. The idea is to conjure a laughable scene, with a bunch of simians banging away at typewriters to no apparent cause and actually producing something astounding.
Biologists who specialize in primates have suggested that the infinite monkey theorem has a number of flaws, as the monkey or monkeys involved are just as likely to bash the keyboard with a rock, or urinate on it. Monkeys who have been presented with typewriters and keyboards have generally produced works consisting only of one letter, with a few neighboring letters thrown in for variation, illustrating the fact that monkeys cannot, in fact, type randomly.
If you change the monkey to a random output device, the probability of this event is more likely, although not by much. William Shakespeare is a particularly bad example to use, as his work was extremely prolific, and it is somewhat absurd to suggest that it could be produced entirely at random. However, when you have infinity to work with, anything could happen, and if there's one thing certain about probability, it's that probability can be very unpredictable.
Some people use the infinite monkey theorem in criticisms of evolution, suggesting that the mathematics of probability are not in favor for the development of life on Earth, let alone evolution, and therefore the hand of God must have been involved. You may also hear references to this theory in critical reviews of books, suggesting that a band of monkeys could have done better than a lackluster author.