I will not post the theory behind it here, because it is difficult, time consuming and not easy to be broken down in layman's terms.
I can tell you that after 5 waves (1-2-3-4-5) there needs to be a 3 wave correction (basic correction is ABC),but there are exceptions from this rule.
Check out @heajin if you want more theory related videos. He explains some of it in his videos quite well.