"Will have" vs. "Would have"
Solution 1:
The two sentences mean slightly different things. In the first case, it is understood that you don't intend to continue attending school.
If I did not have to leave, I would have attended school for 5 years at the end of the year.
In the second case, you express the belief or the confidence that you will still be in school at the end of the year.
Since I'm staying, I will have attended school for 5 years at the end of the year.
Solution 2:
The first sentence is an acceptable English sentence, but as the previous answerer states the two sentences differ in meaning; they are used in different circumstances. In addition to being acceptable if your intent is to not finish school, the first sentence is acceptable if you in fact have already quit the particular school that's being talked about:
- If I hadn't dropped out, then by the end of the year, I would have attended this school for five years.
In fact, the first sentence is acceptable even if you had never attended that school in the first place (though it seems necessary to have considered the option of attending):
- Had I not taken that job, by the end of the year, I would have attended this school for five years.
Hope this helps.