My understanding is the magnets are strategically placed with some north up and some south up. Each magnet has a field surrounding it and will settle at a distance from the other magnets at like an inertia.
When a new (opposing) magnet is introduced the first 2 magnets that interact with it are opposing forces. In this instance the introduced magnet is held stationary so the kinetic energy is transferred and forced along the fields away from the stationary magnet. As the first line of magnets may be north charged there will be a high kinetic energy moving towards the south pole magnets, this energy is enough to flip the first magnet in the second line (south pole magnets) which creates an attraction, once this attraction occurs and the magnets bein to connect the field becomes greater and greater with every magnet attracted until you have a single magnet draw with a wider range of attraction.