A: You were probably at demand-actuated traffic lights when the passer by helped you. These are lights that will only turn green when a vehicle is sensed.
If the sensors aren't working very well you could end up waiting on a red for ages simply because the traffic lights don't know you are there. But sometimes you can get the lights to detect you by changing your position on the road, as the passer by suggested. Most traffic lights don't operate like this, which is why this trick didn't work for you elsewhere.
At demand-actuated traffic lights a loop of wire is buried under the road near the stop line, which works a bit like a metal detector in that it senses steel. You can often see the outline of the loop on the road surface. If the sensors detect that the metal of a vehicle has disturbed an electromagnetic field enough, they will start the light changing process.
At junctions where the sensors are improperly adjusted, smaller cars and particularly motorbikes might go undetected if they are positioned too far from the loop.