A TL;DR version:
Secondary School
S1 to S6 or First to Sixth year. S1s are 11 or 12 depending on their Birthday (cut off point for youngest is they must be 12 by the end of February of S1).
Can leave after S4 if you are 16 by that August, or at Christmas if not. From then on its a choice to stay on for S5 or S6. Pupils can go from the end of S5 to university - some aged just 16.
Quals:
S1-2 Study at a level equilivant to Access 3 in a range of subjects - no/limited chance to choose subjects
S3-4 GCSE equilivant - Standard Grades (Foundation, General , Credit) or Intermediate 1 (General level) or 2 (Credit level), normally in 8 subjects including Maths and English. Standard Grades are graded from 1 to 7 where 1 and 2 - Credit, 3 and 4 - General, 5 and 6 - Foundation. Int 2s are graded A to D then No Award, where D and No Awards are fails.
S5 Int 2s or Highers - most schools expect you to sit 5 subjects. If you have a Credit Standard Grade or Int 2 you can sit Higher, if you would like to study a subject but haven't achieved that level you can opt to do an Int 2. Roughly equilivant to AS level. Graded graded A to D then No Award, where D and No Awards are fails. There are 2 bands within each grade but these have no real importance apart from at a few English universities.
S6 Highers and Advanced Highers (and Int 2s if trying something new and don't want to "crash" Higher). The timetable will probably still allow for the study of 5 subjects but due to other oportunities in S6 and the difficulty of AHs it is usual to do 3 AHs or 2 Highers and 2 AHs (or any other combination of 4 subjects). It is still quite rare for people to sit 3 AHs + 1 Higher, 4 AHs or even rarer 5AHs. Normally AHs are seen to be on a par with or slightly harder than A2s.
Normally for Scottish and for a few English universities Highers are the entry qualification. Exceptions for Scottish universities include Vet Med and 2nd year entry. For Medicine you are not considered for entry from S5 and in some cases conditions may be set on your S6 subjects - most universities expect the study of at least 3 subjects in S6.