Sometimes, the fields short out each other…
Since loops are constantly rising out of the Sun, sometimes opposite polarities will meet in the corona. The field reconnects, simplifying itself, and the excess energy is released as a huge explosion: flare.