I hope to demonstrate this by discussing an experiment with atoms and magnets that is explained in fairly simple terms using quantum mechanics. This is largely how I was introduced to the subject many years ago. But to start, we will need to go over some basic ideas regarding magnets and magnetic fields.
Most of us are familiar with magnets from their ability to attract iron and similar metals but in physics, a magnet is just any material that produces a magnetic field. A magnet influences its surroundings through the magnetic field it creates and reacts to the magnetic fields it experiences from other magnetic objects.
A nice thing about magnets is we can understand how they work without having to be very precise. I'm sure many of you have played around with a bar magnet before, which is often found bent into a horseshoe shape, to create a region of particularly strong magnetic field in between the ends labeled north pole and south pole. You probably also know about and maybe experienced first-hand how opposite poles attract and similar ones repel, and how they attract or repel more when two magnets are brought closer together.
Something less familiar is what determines the force at which a magnet attracts and repels objects. The strength of a magnet is measured by a property called magnetic moment, which is responsible for a magnet's tendency to align with magnetic fields.