Wikijunior:Big Book of Fun Science Experiments/Floating compass
Stroke a needle with a magnet about 50 times. Stroke in the same direction each time to make the needle magnetic, then tape the needle to a piece of cork in a bowl of water. You will see after a while that the needle settles and always points in one direction. This direction is North.
The Principle here is something called magnetism. Magnetism is a basic fundamental force, similar to gravity. The earth has something called a magnetic field, which, very weakly, affects all magnets on earth.
Every metal has little groups of metal atoms called domains. Each domain has a north, and a south side. In a normal pin this domains are all jumbled up and facing every which way. However, after stroking it with a magnet in the same direction, the domains all align, or face, in the same direction. After this happens, your pin is effected by the earth's magnetic field. If you were to go back and forth across the magnet, the domains would become jumbled up and confused.