For the spark to properly jump the electrode gap, IT (the plug gap) has to look like the shortest easiest path to ground. This would mean that if the electrode is contaminated with gas or carbon the spark will run to ground through this. If the outside porcelain is oily dirty or cracked the spark will take this short cut. If the wire back to the distributor or to the coil or a nipple is damaged, spark can escape to the block or valve cover and to ground. If the distributor cap is dirty or wet on the inside or outside or carbon tracked or cracked, the spark will use this as an escape path. If the rotor is dirty, wet or damaged the spark can jump to another ground. If the coil tower under the nipple is dirty, wet, cracked or carbon tracked the spark will jump to the negative terminal or the coil's metal case and to ground.
Carbon tracking is a burnt path on an insulator's surface where a spark has jumped across it and left a trail. Once burned, the trail is blazed and arcing is more likely to continue. Often it will run normally and jump to ground sporadically. It depends which happens to be the easiest path to ground. Engine load, weather lots of things can affect this.
Here's just one example on the inside of a cap.
They are often not easy to find.
Try starting up your engine in a dark garage at night and look for telltale blue flashes on the wires and cap. Rev suddenly to increase the voltage needed to jump the plug gaps. This will only work on outside visible sparks.