It depends on a lot of conditions, such as whether sealant was applied, where and how it was stored, and, to a lesser extent, when it was made.
For example, World War II .45 ammunition tended to be more problematic than most cartridges from that era. A while back, numerous people on this very forum questioned whether hangfires exceeding 1 second were possible with modern ammo. There are several documented cases with old WW2 .45 ammo with hangfires exceeding 5 seconds. I am not aware of this problem existing with any other type of WW2 ammo, but the .45 ammo, in particular, aged poorly.
Additionally, the first generation of non-corrosive primers tended to be less reliable and have a shorter shelf life than current production ones. They eventually stabilized them and they now last as long as the old corrosive ones ever did. Same goes for the first-generation lead-free primers.
Aside from flukes, though, most modern factory ammunition should last forever if stored correctly. I live in Arizona. My father has stored ammo in the garage for decades. We've pulled it out and shot it. It all went bang. We've never had a problem with any of this older ammo. If we used a dry box (not much benefit over a garage in central Arizona, though), it would last even longer.