Sure we can ask something simple like, why do we knock on wood for good luck? Or, as our British friends and the more pretentious among us put it, why do we touch wood for luck? We could stop there, of course, and be as shambling pedestrians milling about a cul-de-sac populated with homes that all have the same cream and taupe colored carpeted living rooms. Better to continue on between the homes past their backyards and into the woods behind them. It is within the native quiet of the woods, the sunlight dappled by tree tops, the air cool and moist, that we can have the best understanding of why we knock on wood for good luck.
Rapping, usually three times, on the nearest piece of wood to christen a wish with good luck or to ward off the more mythological effects of hubris when boasting is probably a very ancient tradition that we can thank our Irish and Cornish friends for preserving. It is in these parts of the world that the holdouts of a long-defunct sociolinguistic group called the Celts reside. In some areas Celtic dialects are still spoken and what were once parts of venerated religious ceremonies have become offhand gestures of superstition. It is within this category that knocking on wood likely lies.
There isn't a person alive on the planet who can say for certain what effect knocking on wood is meant to have, but there are some competing ideas and all of them are based on the Celtic notion that spirits reside within trees. By knocking on wood for good luck, a person may be rousing a spirit within to do their best to make a wish come true. Conversely, knocking on wood as a form of protection when making a boastful claim, such as when one reports they have never broken a bone in their body, is considered to generate noise within the tree so that any malevolent spirit cannot hear the boast and bring an ironic wrath upon the boaster.
But perhaps the people of Western Europe, who merely need to touch the nearest piece of wood to ensure good luck, are the closest to any tradition of the Celts. To these people, simply being around the trees and the forest meant being in the presence of magical power.
The Celts were an Iron Age society that flourished in Western, Northern and Southern Europe and even into the Balkans perhaps a millennium before Christ. They were a tree cult, worshiping their natural surroundings as gods, and venerating things like wells and streams and stones, but above all else trees and, in Western Europe, above all trees, the oak.
We should know very little about the Celts since their religious traditions and customs, led by a priestly class called Druids, were handed down orally. When the last Druid died sometime in the tenth century, the entire tradition died with him. But thanks to the effort of ethnographers and historians like J.A. MacCulloch who published an exhaustive text on the Celtic religion in 1911, we have a fairly good idea what their society was like based on accounts from contemporary authors like Pliny the Elder who wrote the Naturalis Historia, the world's first encyclopedia.
To the Celts, the woods were alive with beneficent and evil spirits and gods and to interact with the trees was to interact with these spirits directly. They practiced human sacrifice, typically in order to ensure a good harvest, and this was often tied, literally, to a sacrifice of a tree as well. The Celts believed that by felling and burning a tree, the spirit living within it was released and, depending on the type of tree and the ceremony, the spirit would join the sun and make it shine more strongly. In what must have been their most important sacrificial rite, a stout man in the prime of his life was tied to an oak in its own prime and both were burned together.
Celtic villages usually had a bile, the tree that was the most sacred in the area. This tree would be hung with ornaments of animal heads and, at times, the heads of people from rival villages who had been vanquished. To cut down a village's bile was a powerful act and at least two Catholic saints - Saint Germanus and Saint Amator -- were canonized for being credited with cutting down a bile in the Celtic village of Auxerre in France during the fifth century, a time when the Christianity struggled to insinuate itself into the ancient beliefs of the Celts and other pagan peoples throughout Europe.
There were less ghastly rites that involved trees. Druids gathered clippings of types of trees, like black locust and elder, for villagers to hang in their doorways to ward off witches and evil spirits. And Celts planted certain species of trees around their homes to invite the beneficial spirits living within to protect the people living inside.
All of this is still pretty far from providing any sort of definitive link between Druidic rites and traditions and our custom of knocking on wood for luck. As Christianity pushed into the areas peopled by Celts after the collapse of Rome and, ultimately, into Celtic culture itself, it followed what would be its usual method of coopting local pagan beliefs and incorporating Christian icons into them, a process called syncretization. So the woodland god inhabiting the trees became the Virgin Mary, and perhaps over time the malevolent tree elves became the watered-down leprechaun. And perhaps, because it was too entrenched in Celtic culture to ever be chased off by Christianity, we still knock on wood because once upon a time there were people believed that we rouse the spirits that lived within it when we do.