The bar magnet compass, which is a name I may have invented, is surprising amounts of fun. Just look at this thing:
This bad boy has a freely rotating holder that sits atop a needle. Put a bar magnet on it and watch the science happen. Now let's crank up the science.
The magnet rotates to align with the local magnetic field. In this case, where another bar magnet is brought close, it aligns itself such that the south end points toward the north end of the other magnet. So opposites attract and that's the end of it, right?
What say we science harder:
In this case, the second magnet it held slightly below the first and off to the side. As expected, the south pole of the rotating magnet aligns nearest to the north pole of the fixed magnet. Now, what would happen if we were to lower the fixed magnet a little?
What has happened?! Now the magnet is pointing the wrong way! What have we done?! Everything I have ever known is wrong! This is worse than the first American Godzilla remake!
Ah, but it comes back to my point above about how a mobile magnet aligns itself with the magnetic field. Usually, this looks like "opposites attract," but there are exceptions to that, as shown here. It is very telling to sketch the magnetic field lines.