1. I receive student loans for living every year, if at the end of the year I have extra leftover must I pay khums on it?

2. Is khums due on books I purchase? I purchase religious books from my money and loan in order to increase my religious knowledge but is this considered an extravagance and therefore does khums need to be paid?

1- There are different types of loan government in western countries provide to their students. Sometimes they don't ask for return, sometimes students must have to return it.
Therefore according to Ayatullah Makrim Shirazi(DM)If it was given to them free of charge, what is left at the end of the year( khums year )has khums due to obligatory precaution.

If it's like debt and it has to be returned to the government then out it what amount is remains with you till the date of you Khums year then khums will be liable on it.

2- Its your expense so if you have used it then there is no khums on it