In our current day and age finding your cardinal directions can be considered an easy task. If someone asks which way is North you can simply pull out your smart phone and open the default Compass app. While those apps use GPS technology, they also rely on more cursory methods, such as magnets, relying on the same principles that allow a standard magnetic compass to function. Even before the compass, early humans relied on physical locations to dictate cardinal direction, utilizing the constellations above to help determine their direction of travel.
While many of our survival type items feature a built in compass, these compasses rely on the same technology developed more than 2,000 years ago. That may sound like a long time, but what that timeline means is that humans relied on other forms of navigation for a significantly longer amount of time than a compass has existed for. Specifically with a magnetic compass, the tool uses the magnetic fields that blanket the earth to find the magnetic north and south poles of the planet. With all of the modern devices and tools we carry in this day and age, some additional knowledge on how a compass works can go a long way when it comes to determining where is True North, versus your compass's direction towards magnetic north.
The first origins of a compass dates back to the Han Dynasty in China, which reigned from 202 BC - 220AD. Made with lodestone, a naturally magnetized iron stone, these compasses were able to show the direction of the south magnetic pole, which is ironically the North Pole. It wouldn't be until the 12th century that compasses would be seen in Europe, meaning the Chinese dynasty's were a millennium ahead when it came to navigation technology. This initial concept of magnetized forces directing the position of a stone or 'needle' is the same technology that we find in modern compasses today, albeit with improvements to allow for more consistency in a variety of vehicles and distances to the poles. Early compasses set a magnetized iron needle which floated in a bowl of water. The positively charged tip would point to the direction of the magnetic forces that originate from the North Pole, showing one cardinal direction, which would eventually allow you to determine the others.
This discovery may have been entirely by accident, but the consistency in which magnetized materials would point in the same directions when free floating must have been a mysterious phenomenon. The thinkers of the time must have used constellation directions to determine the link between the direction of those needles pointed North, in roughly the same direction as the North Star. With most likely zero understanding of the magnetic fields, they unknowingly invented the basis for magnetic compasses that we frequently use today. While a magnetic compass may have varying efficiency depending on your distance from the source, as well as any interferences around you, this would become the bread and butter of compass design.
After the 12th century a magnetic compass with a free floating needle became much more common, becoming a necessity for the intrepid explorer. When they began to see more use over long distances, especially in the case of sea travel, improvements to the designs were necessary to prevent interference from inclement weather and unnecessary movement from a ship. Interference continues to be more of a problem as we add more electronic devices or magnetic components to our kits. Advanced compasses may be liquid filled or placed in gyro systems, but for a standard magnetic compass that fits in your pocket, or on top of a lighter, these can be much more prone to interference.
For example, take two magnetic compasses and place a magnet nearby one. You'll be able to see the needle flip directions in real time, as a greater magnetic force 'tricks' the needle. The closer the compass is to the magnet or interference, the less accurate it will be. The same holds true in storm clouds that are discharging thunder of electricity. The change in atmosphere affects the magnetic fields, disrupting the accuracy of the magnet within the compass. This magnetic pull is not strong, but is immensely sensitive in order to accurately find the magnetic south or north poles. Obviously the magnetic field of the earth is not strong enough to just pull metal objects towards it, but it is enough to point a magnetically charged item in the general direction.
The closer you are to the equator, the less accurate magnetic north becomes from true north. This is because the pull of the north or south magnetic poles becomes weaker the closer you get to the equator. While it still will be the general cardinal direction, it may not be an exact heading. This is where more complicated instruments come in, such as in a lensatic compass, which provides the ability to read bearings and sight holes to properly line up the compass with reference objects. When it comes to true navigation with pinpoint accuracy, items like a lensatic compass provide much greater accuracy when it's required. However, as I mentioned earlier, these types of additions are simply that - add ons to the basic magnetic compass design we have come to rely on over the past 2,000 years. The base premise has remained the same, and when in doubt, turn your eyes up to the stars to find the North Star, as humanity had done for so many centuries prior.