Why do we say ‘knock on wood’?

Something good is going to happen. Knock on wood. That's what we say, but why?

According to A Dictionary of English Folklore, authors Jacqueline Simpson and Steve Roud, the earliest known mention of the practice only dates to 1805. It appears to be linked to 19th-century children's games like "Tiggy Touchwood", types of tag in which children were safe if they touched something wooden.