What is wrong when the car dies after you take off the jumper cables on a 2010 Kia Optima?
Test and replace the battery if faulty. Don't jump-start again!
I agree that the battery is either dead or there are earth connection problems.
However, what was not mentioned in the other answer is that the battery acts as a buffer for the car's electrical system. Is the battery is dead, or even if there are earth connection problems, you may have a charger that produces overvoltage spikes. With no or dead battery (or poorly earthed battery) to buffer these spikes, when disconnecting the jumper cables, the overvoltage spikes could damage the car's electrical systems. This would cost lots of $$$ to repair.
If you have any reason to believe the battery is dead (not just lacking charge), DON'T jump-start. Instead, "jump-charge". Connect the jumper cables and let the battery be charged with the engine off in the recipient car (the donor car could have the engine on to prevent discharging its battery). Disconnect the jumper cables, and only after disconnecting the jumper cables, try starting the engine.
If the battery is old, it may be dead.
If you start having intermittent starting problems, the battery may be dead.
If the battery has been flat for a long time, it may be dead (lead-acid batteries don't like extended deep discharge).
Only if you forgot the lights on for a day, would I try jump-starting. Or perhaps I could try jump-starting also if I had been driving very short trips recently in cold weather, so short that the battery is depleted per each trip.
Alternator is not charging. The top answer is partially right but a car will run on an alternator, therefore a dead battery is not the answer. Most likely situation is this (however without you conducting checks yourself and posting all the results no one can give you an accurate answer) alternator failed whilst driving (possible stalling?) Or it discharged a significant amount and while attempting to start it you've discharged the battery to the point where it cannot sustain operation of the veh. After either event you've then attempted to start the veh without charging the receiving veh battery first so as soon as its started you've disconnected and removed the only supply of power. When jump starting connect vehicles start donor car then run for 10-15 mins then turn off donor and disconnect if the veh starts battery is good if it doesn't battery is bad.