A typical small DC motor has a fixed permanent magnet or two attached to the body as 'stator' and three or four wire-wound electromagnets mounted around the rotating shaft as 'rotor'. The juice goes in and out through two carbon brushes sliding on opposite sides of the commutator, which is a copper tube fixed around the shaft, split along the rotor axis into several sections. These opposite commutator sections connect to various individual rotor windings, making them attracted to, or repelled by, the permanent magnet stator, depending on the angular position of the rotor. So it spins.
Snags are, the brushes spark and create interference, the brushes wear out, and in wearing out the brushes make carbon dust. Not good, especially in a computer case.
With a most cunning plan, some genius turned the idea on its head – let the permanent magnet do the spinning and make the electromagnet windings fixed. Photo (left) shows the stator in a typical PC fan, four sets of windings fixed to the PCB holding the fan electronics. The rotor (right) is a permanent magnet ring 'A' on the inside wall of the fan blade hub, spinning with shaft 'C' which fits in the bearing hole shown left.
To get the polarity of the electromagnets right, so they'd attract or repel the moving permanent magnet, he fixed some Hall-Effect sensors round the casing which switch when the poles of the magnet swing past and, with a bit of logic circuitry, send the juice down the right wires.
No moving contacts, end of brush problems. And with today's semiconductor prices, it's actually cheaper to do!