Spokes occasionally fail when the bicycle is not being ridden, leaned against a wall or sometimes even when no load is on the wheel. These failures are rare, but enough of a curiousity to warrant brief investigation.
The basic failure process is as follows. First, the spoke is damaged by some normal means, such as unload/load cycles in a spoke which is insufficiently stress-relieved. The spoke is cracked, but not cracked through. If the bicycle were ridden long enough, the spoke would fail during the ride. However, before failure occurs, the bike is parked.
Second, when a spoke is close enough to failure, the crack continues to grow under spoke tension, even though the spoke load is not changing. Crack growth is slow, but eventually there is too little material to hold the spoke together, and it fails a sharp noise.
It may seem odd that a crack could grow while the bike is not being ridden. There are at least two things to note. First, the spoke is still under tension even when there is no load on the wheel. Second, when a material is very close to failure it enters a "runaway" condition where the load remains the same or even goes down slightly, but the material being pulled will "neck" and get thinner, so the load is being carried over a smaller and smaller area causing the load to concentrate in a smaller and smaller area, so the rate of tearing goes up.