Trains in India can be booked up to 120 days in advance. This means buying a ticket in advance is wise. If it is impossible for you to book in advance, there are a few ways of arranging a ticket more last minute. I've listed some of them here.
India. Overwhelming, sense-overloading, colourful, wonderful India. Hits you in the face as soon as you arrive and stays with you forever. This is how I felt before catching the night train to Jaisalmer 3rd class. Remember to book in advance or get a tatkal ticket the morning before.