A vacuum leak can cause the engine to run lean, which can lead to a rough idle. Check for any loose or disconnected vacuum hoses, and inspect the intake manifold gasket.
Worn or fouled spark plugs can also cause a rough idle. Check the spark plugs and replace them if they are worn or damaged.
A faulty oxygen sensor can cause the engine to run rich or lean, which can lead to a rough idle. Check the oxygen sensor and replace it if it is faulty.
The idle air control valve controls the amount of air that enters the engine at idle. A faulty idle air control valve can cause the engine to idle roughly. Clean the idle air control valve and check its operation.
A faulty fuel injector can cause the engine to run rough. Check the fuel injectors and replace them if they are faulty.
A faulty ignition coil, distributor cap, or rotor can also cause a rough idle. Check these components and replace them if they are faulty.
A more serious problem, such as a worn piston ring or a faulty valve, could also cause a rough idle. If you have checked the above items and the problem persists, you may need to have your engine inspected by a qualified mechanic.