This app was mentioned in
with an average of
Unless you're covering distances that will require train travel for longer than 18 hours by train, I'd suggest looking at traveling by Volvo sleeper buses.
They're pretty comfy overall. The ones with good ratings are very clean. It's easy to get bookings right up to the day before travel (no need to book and pray for a berth). Try the RedBus site/app to find the right bus for you. They stop at rest-stops every 4-6 hours for food, but if you need to pee, they'll pull over. They're pretty cheap.
For example, Bangalore to Chennai - Rs700 - 8 hour journey.
Bangalore to Pune - Rs 1200 - 14 hour journey. Book the same day as travel. Good buses (well-rated on the app) will have functional chargers, and will offer snacks and water as soon as you board. You also get an option of pickup and drop-off points which might save you a hundred bucks in cab fares traveling to/from a railway station to your hotel.
For long distance travel, trains are much more comfortable and reliable. Book the A/C seats if you want to avoid the cosmic chaos inside the trains. And if you are travelling within a small state like Himachal Pradesh that is to say smaller distances then bus travel will be more convenient (flexibility to board and deboard)
I have personally seen tickets getting booked even just a day before. I now also see Indrail passes on the website on lines of the Eurorail pass. Attaching the link. Call them up for finer details. They will give you almost all the details you would require.
You can check ticket availability here. Select foreign tourist option on scroll down for "quota".
To compare it with bus fares and bus journey options in general, try Redbus app.
Highly popular and reliable. Better option than trains for last minute change in travel plans.