Here are the steps to build an electromagnet:
1. Cut a copper wire for about 1-2 foot long. If the wire has insulation, use wire strippers to remove it to expose the copper conductor. Leave about 3 to 4 inches of wire and then start wrapping the wire around the nail.
2. The copper wire should be wrapped as a coil until the end of the nail.
3. Once you have wrapped the wire around the nail, leave about 3-4 inches of wire on the other end.
4. Use wire strippers to remove some of the insulation from both ends of the wire.
5. Connect the stripped ends of the wire to a D battery by wrapping one around the positive end and the other around the negative end.
6. The electric field in the wire coil creates a magnetic field around the nail, making it an electromagnet.