How do magnetically levitated trains (maglevs) stay on the tracks? Just went on one yesterday, and had a bit of a thrill.
And I was musing on the fact that electromagnetic forces are so strong, that they can keep a whole train up in the air.
But then, wouldn't maglevs be awfully unsafe? Like, you wouldn't even be able to turn a corner safely.
How do they do it? How do they stay on the tracks?
 A: While Anna's answer may be correct at a fundamental level, at a practical level the two solutions used most commonly are:


*

*Wheels - yes, wheels. Not to hold the train up but to run sideways against guide trails to prevent the train moving of its track. 

*More magnets - in the same way support wheels have been replaced by magnetic levitation, the guide wheels mentioned above can be replaced with magnetic repulsors.

A: 
How do they stay on the tracks?

By good engineering is the answer. The same answer as one will get if one asks : how do trains stay on the rail tracks?
When all is said and done, any wheel is levitating. Nothing touches anything. In the usual train tracks, the electromagnetic interactions of the wheel with the grooves surrounding it are what is keeping the wheel on the track. The grooves and wheels are engineered so that all the forces are compensated and the wheel keeps in the groove. The normal grooves are machined to line up the molecules of the metals in the proper geometric form to support safely a moving train and its weight. But nothing is "touching", there is always a "space" covered by electric/magnetic fields .
Levitating lines need different engineering, the magnetic fields have to be designed so as to compensate for the forces, downward and centrifugal, so that the train stays on track.
