Most effective way is using electric current. Anytime a current flows, a magnetic field is set up around the conductor. To increase strength, wind the conductor into a coil. Magnetic flux lines add to each other and produce a much denser magnetic field in the centre of the coil. If a piece of ferromagnetic material is placed in the coil and a current is passed through the coil in 1 direction, the magnetic field of the coil causes the domains to align in the ferromagnetic material