The Rev. Thomas Bayes was an Englishman who lived in the 1700s. While I suppose that religion was his primary work product, he did draft a paper which formed the basis for programs like SpamAssassin. Called Bayesian Reasoning (unfortunately some time after he passed on) , ol’ Rev. Bayes theorized that events that have already taken place might have some usefulness in calculating that something else might happen, even if the events seem quite independent.
To the average recipient of tons of spam, this might make things a little easier:
A system gets some email, and the user flags it as spam. The spam contains certain elements that make it so (say the word Viagra). As more email is put into the system, the user continues to “train” it by denoting messages as spam or not spam based on subjective criteria. As time passes, the system says “I just recieved an email, and it contains elements similar to those that were flagged as spam in the past, so I will give it a score, then see what else I can come up with”. If the system finds enough criteria similar to those that were in messages, received in the past that were flagged as spam, it will then flag the new message as spam.
For the complex answer, including a link to a stellar writeup on the subject, take a look at Sidebar: Bayes and His Theorem – Computerworld.