In most places up until the time I left school secondary education ran from ages 11 through 16, and the five years of high school were referred to as the first year, second year, etc. (or in some cases first form, second form etc.).
So for those leaving school at 16 the fifth year/form would be their last year. Those staying on would enter the sixth form for an additional one or two years schooling, often distinguished as the "lower sixth" and "upper sixth." Not all high schools had a sixth form, so students sometimes had to transfer elsewhere.
Sometime between when I left school (1982) and today, they changed the naming. As far as I can tell we now have a grade-like system, where the 12 years of normal schooling are called "Year 1" through "Year 12," so Y12 would be the last year for anyone leaving at age 16.