you knock on wood because say you say something like iv never broken a bone in my life you would say knock on wood and knock on wood 3 times so you dont jinx your self and break a bone tomarow.
The origin of "knock on wood" is a bit cloudy. It seems to trace back to the European idea of touching wood to ward off bad luck, or acknowledge good luck. The knocking probably stems from the idea of a knocking sound preventing the Devil from hearing unwise statements. The modern American usage began early in the 20th century. There isn't any specific thing to do (you don't have to knock specifically three times as cited above), but the act is common.