On Star Trek: TNG, whenever someone has to leave their post on the bridge for whatever reason, there's always a handy ensign or two standing around who can immediately and capably take over. So why are there so many extra officers standing around on the bridge?
Your first sentence answers your second. There are extra officers on the bridge so that they can take over for officers who have to leave on Away missions or for emergencies. They're typically doing some sort of work on the supportive stations at the rear of the bridge (on the Enterprise D; they're elsewhere on non-Galaxy starships).
According to the Next Generation Technical Manual, these stations are Science Stations (2), Mission Ops (a backup for the Ops console), Environmental, Engineering, and Guidance/Navigation.
It's also smart to have more people than necessary on the bridge in case of an emergency situation. Environmental is typically automated and left empty, but in a battle or some other red alert, it'll likely be more important than Science. So it's important to have someone on the bridge to be able to take over that station without vacating, for instance, Conn.