As said before, swings and roundabouts, you have to risk assess each day, each road, traffic etc etc...and you can still sometimes make the wrong decision, or have circumstances work against you.
I'll over or undertake, depending on how wide the cycle lane is, how wide the road is, how heavy the traffic is etc etc.
I've overtaken a queue, only to find the lights changed quicker than i expected, then to find myself in no mans land. Usually you can filter back in, but i have got stuck once.
The cycle lanes in Peterborough are quite good, and i've never really found any problem with cars not expecting you to undertake (the lanes are coloured green and quite distinct from the road). If the lanes blocked (sometimes it happens)..i'll just wait....sometimes i'll switch and overtake.
I'd generally only overtake if the queue is moderately short and the traffic is static...or coming to a halt.