The U.S. Army has largely ceased to use the bayonet as a weapon, but the U.S. Marines and British troops are still quick to fix bayonets. The bayonet was always largely a psychological weapon. Even during the American Civil War, very few casualties were caused by bayonets. Even though troops were still trained to use the bayonet well into the 20th century, it was found to be counter productive most of the time. For example, during hand to hand fighting, rifles were found more effective, at very close quarters, when used as clubs. This was rather dangerous for the user if the rifle had a bayonet affixed. Many troops found that a sharpened entrenching tool (short, folding shovel) was more useful, and lethal than a bayonet on the end of a rifle. But the Brits and the American marines still believe in intimidation, and when advancing on enemy troops will make use of bayonets on rifles to further demoralize enemy troops they believe they have already frightened.
One thing the bayonet did become popular for was crowd control. Civilians were still intimidated by a line of troops pointing rifles, with bayonets attached, at them. And so it came to pass that British troops, and sometimes U.S. Marines, would be found holding rifles with fixed bayonets while confronting unruly civilians. At the very least, this kept the civilians from crowding the troops. And it was often possible to force a crowd to move along by advancing at them with bayonets leading the way.
Thus its peacekeeping and riot control that keep the bayonet in business. Several attempts, in the last few decades, to delete bayonets (that can be mounted on the end of a rifle) from the armory, have failed because someone brought up the crowd control angle. And so it comes to pass that bayonets survive because of their usefulness against unarmed opponents, rather than armed ones.
While the bayonet is generally considered an obsolete weapon, this is not always the case. Its still useful against unruly civilians and nervous enemy troops. Americans dont often see this, because its the British who are most enthusiastic about using the bayonet, and the American media tends to favor photographs and video of American troops, especially army soldiers, who are the most numerous force in Iraq.