Rear derailleur breakages
If a derailleur breaks on the road, you can try to find a gear combination such that the chain can be stably placed on a given chainring and cog and shortening the chain to fit on this combination. This question gives some guidelines on how to select that cog and chainring. Note that you should also check the wheel for damage -- depending on how the derailleur goes, you may de-tension some spokes or do other wheel damage. You basically need a chain tool and ideally a quick link/special rivet to shorten the chain. 

In Video form: 
                
            

As for why derailleurs break on the road, I'd say wearing out, being out of adjustment, bent or taking an impact would be reasonable causes. One can avoid some of these by not putting the bike derailleur side down and avoiding impacts to the derailleur.