Sort of like “Why did the chicken cross the road”? Maybe the better question should be “UNDER WHAT CIRCUMSTANCES did the duck cross the road”?
I think you’ll enjoy this 27 second video — the German voice over isn’t relevant — just watch the ducks and the traffic signal:
I’ve watched it a few times trying to figure out what the actual stimulus was for the lead duck — it certainly appears like he recognizes the light change. Regardless, once the right conditions were in place — in other words, a safe environment to take the risk of crossing the road — every duck took the leap of faith and walked.