Horseshoes have long been considered lucky. They were originally made of iron, a material which was believed to ward off evil spirits, and traditionally were held in place with seven nails, seven being the luckiest number. The superstition acquired a further Christian twist due to a legend surrounding the 10th century saint Dunstan, who worked as a blacksmith before becoming Archbishop of Canterbury. The legend recounts that, one day, the Devil walked into Dunstan's shop and asked him to shoe his horse. Dunstan pretended not to recognize him, and agreed to the request; but rather than nailing the shoe to the horse's hoof, he nailed it to the Devil's own foot, causing him great pain. Dunstan eventually agreed to remove the shoe, but only after extracting a promise that the Devil would never enter a household with a horseshoe nailed to the door.
Opinion is divided as to which way up the horseshoe ought to be nailed. Some say the ends should point up, so that the horseshoe catches the luck, and that the ends pointing down allow the good luck to be lost; others say they should point down, so that the luck is poured upon those entering the home. Superstitious sailors believe that nailing a horseshoe to the mast will help their vessel avoid storms.
Source - wikipedia