Some travellers like taking trains in Myanmar, others hate it, mainly due to speed but also lack of air conditioning (with the exception of Yangon-Mandalay, which has AC). Trains there are usually slower than buses and slightly more expensive than buses. I only took one train in Myanmar and it was between Yangon and Bagan.
Buying train tickets is very easy though. You can do it one of three ways:
Buying in person: each city usually has only one train station and with the exception of capital Naypyidaw they're all in the city centres. Everything I read recommended getting the ticket 1-3 days ahead of time. Ordinary class seats are available for reservation 1 day before, and upper and first class seats are available 3 days prior. Where to buy: in Yangon, you book at the train station itself for same-day trains, and at the Railways Booking Office (located here, one block south of the train station) for advance reservations. In Mandalay and Bagan, you buy both same-day and advance tickets in the stations. Note that purchase in person is by cash kyat only and you'll need to present your passport
Buying online at 12Go or MyanmarTrainTicket.com (I recommend booking online): 12Go is one of the largest transportation booking portals in Southeast Asia. I live in Singapore and I use it frequently to book trains and buses in Malaysia. It's very reputable and has nice UI that's very easy to use. MyanmarTranTicket.com is what I used for my Yangon->Bagan train ticket. They're an government approved agency based in Myanmar and their website is very easy to use (though their prices were a few dollars higher than 12Go). For an added $8USD they deliver your ticket to your hotel in Yangon (delivery is free if you're in Mandalay or Bagan). Both of these websites accept major international credit cards (Visa, MC, AMEX) and you need your passport to book online as well.
Ask your hotel to help you out: if you're staying at a decently-sized hotel, you can always just check with your hotel and have them help you book your ticket, for a small fee. They would usually ask you to give them cash kyat upfront for the ticket