They wait 17 years, and the number isn't random
Periodical cicadas spend 13 or 17 years underground, then surface all at once. Both are prime numbers, and that appears to be the point: predators breeding on 2, 3, or 4-year rhythms can never reliably sync with a prime-year feast. A 13-year and a 17-year brood line up only once every 221 years, which also keeps the two cycles from interbreeding and blurring their timing.