There isn't just one thing that could cause a car to stop while you're driving, but there are a few different things. A person could have ran out of gas and needs to check the gas gauge, there may be something wrong with the ignition system, and bad fuses, relays, and other systematical problems. It could also be caused by bad injectors in the fuel system. The vehicle would definitely have to be checked by a mechanic.
There is also a issue where it could be the electrical wiring. Depends on the vehicle and how the wiring is done. Ford had their wiring going over the exhaust manifold, with temperatures over time can cause damage to these wires.