Here’s How to Crack It
The total magnetic force on the wire is equal to the sum of the magnetic forces on
each of the three sections of wire. The force on the first section (the right, vertical
one), FB1, is directed to the left and the force on the third piece (the left, vertical
one), FB3, is directed to the right. Since these pieces are the same length, these two
oppositely directed forces have the same magnitude, Iℓ 1 B = Iℓ 3 B, and they cancel.
So the net magnetic force on the wire is the magnetic force on the middle piece.
Since I moves to the left and B is out of the page, FB2 is directed upward.