What would cause engine to idle rough and die when car slows down or stops?
It depends on what kind of car you have. Three things are needed
to "make fire" in the engine: fuel, air, and spark. If any of these
is interupted then it can sputter or just not run. How those three
gets there depends on the car. Older, carbureted engines mixed fuel
and air in the carburetor and then moved them into the piston. Fuel
interuptions would happen at the carburetor. Air interuptions
rarely happened, but could be because of poor settings inside the
carburetor. In newer engines the air and fuel are brought in
separately. A sticky fuel injector, low fuel pressure, or a
computer problem can cause rough idling. How the "spark" gets into
the cylinder, via spark plug, has not changed much. What triggers
the spark has. In older cars it could be a mechanical
distributor/rotor/points system. If there were debris in there, or
even poor spacing then the engine could rough-idle. In the newer
systems its all computer controlled or hybrid. It could have a weak
or discharged battery. It could have a weak alternator/generator.
It could have a clogged air or fuel filter. There are a lot of
things it can be. A quick inspection can tell a qualified mechanic
what the problem is. How he goes about determining what the problem
is and how to fix it really depends on the type of Car.
It could be something as simple as a fuel filter! Try that.
Then spark plugs and wires. Air filter.
If those check out fine or you have replaced them. Check for stored
trouble codes or an illuminated CEL.
It could also be a Idle Air Controller problem, if they get dirty
they can stick. Also, on computerized cars, crank and cam angle
sensors can go bad. Lots of things here.