A compass is made of a magnet and the Earth has a magnetic field. We know the rule about magnetic poles that opposites attract. So, the south pole of the magnet (usually the colored side of the needle) is attracted to the Earth's north pole. That is why it is always pointing to the north.