In the early 20th century geologists became aware that certain rocks exhibited magnetism that was different in orientation from the current magnetic field of the Earth. It was mostly ignored as anything significant at the time mainly because it was not properly understood – or what it might imply. Eventually they acknowledged it was a signficant observation and that meant people tried to find out what it meant. A number of papers in the 1960s shed some light on the process by identifying polarity transitions in lava flows (igneous rocks) and sedimentary layers (sedimentary rocks). When lava cools rocks are magnetised in the direction of the field prevailing at that particular moment in time. Later, simply by recording the many different rocks from different geological periods researchers think they are able to create a reasonable record of the Earth's history of magnetic wandering. See https://phys.org/print463743927.html … but none of this takes away from the fact that it is not fully understood as a geological phenomenon – possibly because it might mean having to look at certain taboo subjects (that are best left undisturbed).
At Steens Mountain in SE Oregon Miocene basaltic flow (lava) from 15 million years ago shows the process of a complete reversal event that takes place extraordinarily rapidly – between 3 and 8 degrees a day it has been judged. Within the concept of gradualism this is a very rapid reversal event as geologists like to think the process takes an inordinate amount of time (hundreds of years is rapid in geological time measurement). However, there is one problem in that igneous rocks are episodic – or that is being touted as a problem. If magnetic reversals have an origin in catastrophism they would indeed be episodic. Now they are looking at sedimentary rocks under the illusion these actually mark a full geological history of the earth, layer to layer (not universally of course but locally). Deep sea cores from drillings in the North Atlantic (a vertical section of the sea floor) are said to represent a sequence of magnetised strata. It is now understood they occur much more frequently than previously imagined and it is to be hoped they can get a proper idea of how often that may be. In spite of all this the cause of reversals is still a big unknown. It has a random aspect according to Robert Coe, speaking at the AGU conference.