Magnetic fields are used by scientists in two primary ways. One is to affect the particles, either electrons or protons or neutrons, that are inside every material. It can affect those in two ways.
One, if they have an electric charge, and they're moving, like an electrical current, then the magnetic field actually bends that current around and forms that into a circular orbit.
The other way to affect these particles that are in every material is if they have their own magnetic field. They can line up those magnetic fields in the same way as compasses line up with the Earth's magnetic field. The magnetic fields of each individual electron will line up with our magnetic field. That can cause a material that wasn't a magnet to become a magnet, or to greatly change the way that it operates or that it reflects light.
These are the kinds of experiments we do to understand how materials work.