Every signalized intersection has a designated major street or movement, usually the through movement of the major street. All other movements are actuated or on demand. In order to have actuation, some sort of vehicle detection is necessary.
In Gilbert, the most common form of vehicle detection is a magnetic induction loop connected to a detector. This is simply a wire loop embedded into the pavement of each lane at the stop bar that extends back 20, 40 or 60 feet. When a vehicle is over the loop, the signal for that movement is "triggered" or called. Once a green light appears, the signal will stay green as long as it needs up to a set maximum amount of time. If only one or two vehicles are present then the green may last for 10 seconds or so. If 15 vehicles are present then it may stay green for 30 seconds or so. If no vehicles are present, the signal will not cycle to that movement.
Unfortunately, asphalt pavement is relatively soft and loops are very fragile so they often fail. When this occurs, the signal is set to cycle to that movement all of the time for an amount of time consistent with the amount needed during heaviest traffic.
Some signal intersections have been changing to use non-pavement invasive types of vehicle detection - video detection.
Video detection works by continuously taking a "picture" of an approach lane then comparing it to the previous picture. As long as the picture is continuously different than its previous one, the signal will stay green once it begins.