could we just add, that it happens on bikes / brands that build rear wheels with cheap spokes, they are generally plain gauge and can't cope with the pressures put on them. They don't stretch and this is what causes them to snap.
Spokes break because of metal fatigue. Heat produced by friction at the J bend accelerates metal fatigue.
Spokes are made with cold processes, forging, bending, rolling, the J elbow is where the metal is stretched to form the bend. Starting with a 13G (2.3mm), the bend reduces the average diameter to about 2mm, reducing its tensile strength (breaking force) from 400kgs down to 200kgs for a stainless steel spoke.
The metal fatigue is proportional to the mileage and number of road bumps / pot holes - the front hub motor is suspended, its spokes will never be subjected to much stress. Rear hub motors have very tight fitted spoke holes, not good.
Some bikes have more problems with spokes than others because of the wrong match of radius of the spoke holes and the particular spokes. If in doubt, check that the spokes you choose can move fairly easily in the spoke hole. Powerful motors may have thicker flanges, requiring spokes with larger radius.
The quality of the steel matters but only fractionally. Carbon steel 13G have braking force around 350kgs, stainless steel about 400kgs.
Straight gauge spokes have higher breaking force than double butted, don't be fooled by the spiel. It's all physics, nothing to do with brands.