I am a student and not working. is it necessary for me to give khums? If i invested money somewhere and i get monthly money from that, is it necessary for me to give khums in this condition as well? if in both conditions Yes than what is the method ?

Indeed if you have an income regardless of its method or source in general you have to pay the Khums on the annual savings.
So at the end of every year you will pay 20% of what ever you have saved. The money which is khumsed will not be khumsed again next year if it stays till then.