Magnets produce a magnetic field that affects the orientation of atoms in other nearby matter. It is the aligning of the electrons within an atom that causes a metallic object to be attracted towards a magnet.
Here’s how it works. When you allow a magnet to come close to a metallic object, the electrons within the atoms of that object begins to align to the direction of the magnetic field produced by the magnet. This alignment then causes the metallic object to become magnetized, making it another separate magnet that exerts its own magnetic field. Furthermore, whenever two magnetic fields are close enough, they tend to pull each other towards them, to combine into a single magnet. That is how a magnet attracts a metallic object.
But why does the metallic object lose its magnetic field when pulled away from the magnet? This is because the directions of the electrons in the atoms of the metallic object move randomly until they are interfered with by the external magnetic field. When you pull the magnet away, the electrons return to their original positions, thus dissipating the temporarily produced magnetic field.
To make a temporary magnet out of a screwdriver, you need a magnet. A refrigerator magnet will do just fine. Rub the refrigerator magnet on the metallic part of your screwdriver several times in one direction – remember, in one direction. This is so that you will align the direction of the electrons in the atoms in your screwdriver all the same way. After rubbing the magnet, say, 60 times, viola, you now have a magnetized screwdriver.