
The bar magnet is suspended on a string because it is in a magnetic field. The magnetic field causes the magnet to align itself with the magnetic field lines, which are oriented in the north-south direction. The magnet cannot move in any other direction because the magnetic field lines are not oriented in any other direction.