Sounds like the alternator and eventually it wont start back up for you
try cleaning the carb. generally when it starts and dies it is a sign of a blocked passage in the carb
Optima
change fuel filter
The car ran out of gas, we put gas in the car and it won't run for longer than 3 seconds
It sounds like your alternator is no longer recharging your battery. You probably need a new alternator.
The fuel tank size on a 2007 Kia Optima is 17.2 gallons. The price for a used 2007 Kia Optima starts at $5,993 from a dealership.
There is most likely something in the gas tank. When the car starts the fuel pump starts sucking in fuel and when the trash gets to it the gas will not be able to flow through the clogged pump so the car stalls. When it stalls the fuel pump stops suction and the trash comes out allowing it to start again.
my suburban wont start
Could be a clogged or partially clogged fuel filter, and/or the fuel pump itself. The asker doesn't say whether the car will restart immediately after is stalls or not.
car starts but shut off while driving
the idle jet in the carb is blocked and needs to be cleaned out and reset
Possibly Crankshaft Position sensor