That's what you pay mechanics to figure out. Assuming you didn't run out of gas, there's hundreds of electrical parts, wires, and connections in the fuel supply, ignition, and fuel injection systems that all have to work. A failure of any one of them will leave you sitting on the side of the road. GM fuel pumps are well-known for quitting while the engine is running, leaving you stranded on the highway. Other brands, Chryslers for example, most often fail by failing to start up so they leave you stranded at home or at work. Crankshaft position sensors and camshaft position sensors are common failure items too. They often fail when they get hot and work again after the engine cools down for an hour.