The physics
A wire with a current feels a push in a magnetic field. The push is at right angles to the wire and to the field.
F = I L × B F = B I L sin θ
To float a rod, the push must hold its weight. Then the threads go slack.
B I L = m g
A bent wire feels the push of the straight line joining its ends. This holds in a uniform field.
Where the field changes from place to place, add the pushes piece by piece. The work to drag a wire is the area under its F–x graph.