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.
Every now and then we stay in places that help us out. The people who work there take us in and allow us to really experience the place. It's something I hope will happen more and more in the future.