This may be true of certain short distance suburban trains, but on most other trains, there is an efficient system of reserving and allotting of seats. The Indian Railways is the third biggest network in the world (trailing Russia and China) and covers 6800 stations. Thus, you will find most cities and major towns connected by railways.
To check the train timings and fares, go to www.indianrail.gov.in, one of the official websites of Indian Railways. If you find this site unrewarding, go to another official website www.indianrailways.gov.in.
There are eight types of classes on Indian trains, but all are not available on all trains. Most popular for overnight trips is 2 tier- AC (air conditioned second class with two tiers). For those, who can splurge more, there is AC-1 class (air-conditioned first class). Backpackers who want the real Indian experience might want to travel by sleeper class (SL). AC-3 is a mid option with second class like cabins, but with air conditioning. For journeys in daytime, AC chair cars (CC) are a comfortable way to travel when it is provided.
Rajdhani Express is an air conditioned super fast long distance train connecting Delhi with major cities like Mumbai, Chennai, etc. Shatabadi Express trains are excellent day time superfast trains connecting Delhi to places like Amritsar, Agra, which feature AC chair car facility. Duronto Express is also superfast trains linking major cities on a nonstop basis. It is faster than the Rajdhani Express.
For most trains, especially long distance trains, prior reservation is necessary. Nowadays, reservations have been completely computerized. Most trains get completely booked weeks and months in advance. The www.indrail.gov.in will reveal availability of trains between stations and earliest date of available berths. Bookings are available 60 days in advance. Short distance trains may have shorter periods of prior booking.
The railways ticket system works on the basis of a PNR number (Passenger Name Record). This is ten digit number assigned to your tickets to reflect its status. After the whole train is booked with passengers having confirmed reservations (CNF), a few tickets are earmarked for Reservation against Cancellation (RAC). Once RAC seats are exhausted, more potential passengers are given waitlisted (WL) status.
You can board the train if you have an RAC ticket. You will be assured a seat and if others cancel reservation, you will have access to berths. After all RAC tickets are confirmed, place is made for Waitlisted passengers. You need to keep a check on the status of your ticket for 24 hours prior to boarding the train. The good news is that now it is possible to track PNR status on mobile.
Foreigners have a special quota attached to some trains. So, they can hope to get tickets at short notice. The best way to book tickets are at the counter or recognize tourist bureaus in major cities.