When the magnetic dipoles of a metallic object are aligned into a direction, magnetism occurs. To demagnetise a magnet, you must randomise, or cause disorder, in the magnetic dipoles. There are several ways to do so.
Heat the magnet past its Curie point. This can be done with either two copper wires hooked to a battery or generator, or with a butane torch. The Curie point is the temperature an object reaches where it loses its ferromagnetic properties until cooled gain. The Curie point varies widely, depending on the type of metal (Nickel, for example, has its Curie point at 627K). The energy provided to the magnetic dipoles will cause the magnet to point in different directions, thus warping the poles.
Hit the ends of the magnet with a hammer. This will destroy the ordering in the magnet.
Use an Alternate Current field to alter the magnetic dipole's order. This can be done by connecting the magnet to an AC power circuit by setting it inside a solenoid, a copper wire loop wrapped around a metal core hooked up to an electric current.
Stroke one magnet with another. In some cases, this will demagnetise the magnet getting stroked.
Be careful when using an AC power circuit so you don't electrocute yourself.