Textbooks and Heaven only are ideal
--John Updike from The Dance of the Solids
In the ideal traffic light system, a car will hit a single red light and after that will be part of a green wave that runs in some direction. Furthermore, this ideal traffic pattern has two sets of green waves - one running E/W and another running N/S. Each green wave pulse hits the intersection as the other direction has a red light, but no cars waiting at it.
A 'green wave' is a traffic pattern such that if a car travels at a certain velocity it will not hit any red lights. This is seen as the best case for many traffic systems, however this is not always the case. For the green wave to work, all of the traffic lights in the system must be synchronized and using the same pattern. Furthermore, there should be no stop-signs between two lights - this would throw off the green wave because each car would need to slow down and stop at the sign. When tradeoffs are required, they are made to favor the direction with the most traffic.
Recently, many traffic lights have turned to sensor driven systems. This works nicely for times when there is an intersection with the vast majority of the traffic heading in one set of directions, in essence 'starving' the other direction until it is actually needed. When the sensor detects a car waiting, it will allow that car to go through the intersection. Just as with a stop sign, this will throw off the green wave.
Adding into this equation is that of light rail. Light rail (and heavy rail) are often given priority at intersections (few people are silly enough to argue right of way with a train). I have seen a light go from green, to yellow (and then have a light rail train reach the intersection) to green. This speeds up the mass transit at the penalty of slowing down personal cars. Some traffic light systems have sensors designed to detect emergency vehicles (police cars, ambulances, and fire trucks) and hold the light green or quickly switch to a green light light for the emergency vehicle.
Traffic patterns change through the day - most notably the time called "rush hour" when people are commuting to or from work. During this period of time, there is a drastic increase in the number of cars on the road. When this happens the timing for the green wave previously designed for optimal becomes much worse.
To an extent, no matter what the solution for the annoyed commuter in one car, it will make something else worse. If you increase the time for your direction to go through the light, this means that the traffic on the other side will build up more and take longer to get through the light.
Each car takes some time to accelerate to the proper speed. The 10th car waiting does not start moving forward at the same time as the first car waiting. Slight slow downs (not everyone has a race car) become magnified as each car starts from a dead stop (consider the VW Bug advertisement "0-60: yes").
Accidents will further cause congestion. When traffic is heavy there is an increased chance of accidents, and the accidents that do happen cause much more congestion than when traffic is light.
The only real solution to this is to increase the bandwidth (throughput) of the traffic. For water, this means either a bigger pipe or higher pressure (faster water). For cars, this means either adding more lanes (likely impossible in any urban area) or providing every car with zero-obscene acceleration so that there is no delay between the green light and all the cars getting through (please realize the possibility of accidents in this case). Neither of these are feasible solutions.
For a paper on the math behind traffic light flow, see
On Traffic Light Control of Regular Towns --