The mechanisms of pole reversal are not fully understood, but current theory is supported well by mathematical simulations.
The primary structure understood to be responsible for advection, the generation of the Earth's magnetic field, is the outer core, a fluid layer comprised primarily of iron and nickel which lies between (roughly) 2900 to 5200 kilometres below the surface. A combination of the rotation of the Earth, convection of the iron-rich fluid in the outer core, and an abundance of free electrons due to the heat and pressure at those depths causes the creation and evolution of a complex magnetic field pattern. The main dipole - that which defines our north and south - is constantly in motion both in strength and orientation.
The inner core, a solid ball of iron and nickel, plays a secondary role in stablising the main dipole. Whilst it cannot produce a magnetic field due to its being solid, the field generated by the outer core is induced within the inner. This induced field then acts to regulate the far more dynamic fields of the outer core. Essentially, the main dipole would be far more dynamic without the influence of the inner core. Nevertheless, its field strength remains dependent upon those produced in the outer.
Only when a weakened inner core field coincides with enough specific activity in the outer core can the poles migrate enough to reverse. Geological records indicate that this has happened numerous times throughout history. However, unlike the sun's solar magnetic activity cycle which repeats approximately every eleven years, the Earth's pole reversal is far more variant due to these complex interactions.