Most spokes failures are due to stress at the elbow caused by unloading when the tire in the vicinity of the spoke pushes against the ground or an obstacle (e.g. pothole). Spoke nipples can loosen if the spoke becomes slack, effectively loosening the rest of the wheel and increasing the vulnerability of the remaining spokes. High quality wheel building practice reduced these risks by "stress relieving" spokes (momentarily pulling on them hard enough to stress the elbow past its elastic limit) and applying proper (high) tension to them.
Spokes do not generally stretch (undergo plastic deformation) in use. Normal wheels, even with what feels like high tension, have spokes at about 1/3 yield stress. This stress does not increase much when the wheel hits an obstacle (10% is the number that comes to mind - see Brandt's The Bicycle Wheel for more on this). Spokes that have not been stress relieved can loosen as the elbow bends to fit the shape of the hub flange. The nipple can unscrew, though not if the spoke remains in tension. Also very thin butted spokes can twist and deform when you turn the nipple, and will elongate at the same time.
Brandt recommends very high tension: tightening spokes to the point that the rim begins to deform, then backing off only a little. Cheap or ultralight rims (the race rims dogman mentioned?) might be too weak for this approach, but quality rims designed for durability will take high tension without a problem. If in doubt, the rim manufacturer should have a recommended maximum spoke tension, though it can be hard to track down.
I rarely have any trouble with my wheels - they stay true from the first ride and I can count the number of spokes I have broken on one hand, despite a good deal of hard mountain bike riding in the pre-suspension days. I attribute this to conservative choices in parts (durable rims, 32 or more high quality spokes) and careful wheelbuilding or checking (stress relieving, plus retruing and tensioning if necessary) of factory wheelsets.
That said, I don't own any hub motors. Of course the shorter spokes are less springy, making them more likely to go slack and cause problems. I also have to wonder whether poor quality spokes are used in some hub wheels. Even with the challenges of hub wheels (weight and less spoke springiness), I have to assume that most spoke failures are due to poor materials or build quality.