How i can book the train ticket in advance?At any JR station with a ticket counter.
must it be done within Japan or can be done online?
The only overseas option I am aware of is the following service:
http://www.jet-lag.org/
2) Can i make the reservation in Kyoto?
Yes.
3) If reservation is not possible, what are the things i need to do in order to ensure i can get the ticket for my departure?
The Kitakuni has unreserved seats. Even if you cannot make seat or berth reservations, you can use the unreserved cars.