Maybe looking at S5/S6 as a two year block.
Within they two year block students can sit a combination of highers/advanced highers or even Nat 5s if they need to fill a gap ie maths/English pass.
The most able students could take a path of:
S5 - five highers, S6 - three advanced highers.
Advanced highers are very good for applying to university in England esp for sciences but not always necessary.
Other students may opt for a different combination:
S5 - 1 Nat 5, 4 highers, S6 2 highers, 1 advanced higher.
For example both my dc finished school with 6 highers, 2 advanced highers.
The higher classes will contain a mix of s5/S6 students.
Age at starting s5 will range (in August) from 15 years 6 months (non deferred Feb birthdays) to 16 years, 8 months (assuming some Dec birthday deferred which is becoming more common).
Assuming that those starting s5 stay on to S6 leaving in June of S6:
Youngest will leave at 17 years 4 months
Oldest will leave at 18 years 6 months.
If you move in spring (May) of 2022 your DC will be 17 years 3/4 months. They could join the school with a view to maximise qualifications in one year and leave in 2023 - the best mix if only staying in school for 1 year would be 5 highers. Your DC would then leave school at 18 years 5 months.
Theoretically you can ask for your DC to stay at school for another year and sit a wider range of subjects and/or advanced highers. It will be up to council/school to confirm that they would fund your DC until 19+ and as pp have said Scottish schools are very flexible. The sticking point would be would your DC want to stay in school when everyone her age has left.