Magnetism is linked to the movement of charge, such as electrons.
When charges move they also create what are known as magnetic fields.
Moving charges also feels magnetic forces from magnetic fields.
These are the same fields and forces that hold your fridge magnets onto the steel door of your fridge.
Magnets like these use materials which generate a constant magnetic field and are known as 'permanent magnets'.
The electrons and/or nuclei of atoms within these materials generate magnetic fields which all line up to produce a strong permanent magnetic field.
The Earth has a magnetic field, due to the metal materials inside the Earth.
If a magnet is allowed to move freely it will tend to align with the Earth's magnetic field. This is how a compass works, always pointing to the North pole.
Magnets have two ends, known as the North and South 'pole'.
Poles that are alike will be pushed apart, poles that are different will be pulled together.
Image credit: Geek3, CC BY 3.0, via Wikimedia Commons
We have already said that when charges move they create magnetic fields.
So when electrical current flows along a wire it will create a magnetic field.
This can be very useful because it allows us to make an electric motor or an electric actuator.
A magnetic field created by a wire will mean that it can push or pull on a permanent magnet or on a field created by another wire.
This means an electric current can be used to produce linear movement (actuator) or rotational movement (motor).
If we wind the wire many times around something known as a 'former' we will get a very strong magnetic field, increasing the pull/push forces.
The more turns of the wire, the stronger the field.
A current (I) flowing along a wire wrapped around a former (in this case an iron core) will create a strong magnetic field (B), as shown by the black field lines:
Image credit: P. Sumanth Naik, CC BY 3.0, via Wikimedia Commons