To represent magnetic fields, field lines are used, which are effectively arrows that you draw around your magnet from the north pole to the south pole.
Field lines show the relative strength of the field in different places, as the more dense the field lines are, the stronger the magnetic field is in that area.
The benefit of representing our magnetic field with lines like this is that it shows us where the field is and which direction it's acting in, as well as its relative strength in different places.
The needle of a compass is a tiny bar magnet and will always line up with the field lines of whichever magnetic field is put in, and it will always point towards a south pole of a magnet.
If we put our compass over a magnet, we could draw an arrow in the same direction as the compass needle and as it's heading towards the magnet, we know that this must be the south pole.
If we flip one of our magnets around and bring two opposite poles close together, they would attract one another because all the field lines would be going from north to south and so be attractive.