Hiroshima is a major station on the JR West www.westjr.co.jp San'yo Shinkansen line. It is roughly 40 minutes from Okayama (¥5350) and 90 minutes from Shin-Osaka (¥9440). Tokyo is four hours away via Nozomi (¥17,540) and five hours via Hikari. If you have a Japan Rail Pass, you cannot use the Nozomi, so if you are traveling from Tokyo or Nagoya you will have to take one of the two hourly Hikari trains and change at either Shin-Osaka or Himeji to the Hikari Rail Star or Sakura.
There are also a few Hikari departures from Nagoya in the morning that run directly to Hiroshima with no change of trains necessary.
Traveling overnight by train from Tokyo, you can take the 10 PM Sunrise Izumo/Sunrise Seto train to Okayama, then take a Mizuho train to Hiroshima, arriving around 7:25 AM. Japan Rail Pass holders using this route must change to a Kodama at Okayama, arriving just before 8 AM.
Regular train services run through Hiroshima on the San'yo Main Line (between Kobe and Kitakyushu), along with several local lines.
Overnight by train with rest stop
If you hold a Japan Rail Pass, and you wish to travel overnight from Tokyo (or any other distant city), you may want to split up your journey, stopping at an intermediate destination en-route in order to sleep somewhere. The cost incurred will only be for the hotel room; the Rail Pass covers your transportation. This is a good way to travel overnight, especially if you are able to find cheap accomodations, such as a business hotel. Yes, it may be a little hectic, and it might require some research, but this method carries two significant advantages: location and money. You will more than likely find good accomodations very close to a main train station in a smaller city, compared to a big city such as Tokyo, and it will more than likely be cheaper than hotels found in a big city. You could use the money you save to forward some of your luggage to Hiroshima using a luggage delivery service and take an overnight bag with you, which will make the journey easier.
As of March 2011, here is one way you could go about this from Tokyo: at 7 PM, take the Hikari train for a 4-hour ride to Himeji. Once there you can take a rest at Himeji's Toyoko Inn which costs as low as ¥5600 for a single room. At 6:55 AM the next morning, board the first Hikari Rail Star of the day and you will be in Hiroshima by 8:00 AM. Green Car Rail Pass users can take the 7:20 AM Sakura for access to Green Car seating and be in Hiroshima by 8:25 AM. This trip takes longer than taking the overnight train and shinkansen connection as described above, but it is cheaper; you only have to pay for the hotel room, complete with your own toilet and shower.