Riga is the hub of Latvia. Therefore, it is always easy to get from Riga to anywhere in Latvia, and your trip to Latvia will most likely start and end in Riga.
Railway is the primary public transportation from Riga to the nearby cities and towns (Jūrmala, Jelgava, Sigulda, Lower Daugava valley). It may also be used to go to the Eastern Latvia (e.g. Daugavpils) and further east into Russia.
For such long-distance routes, however, air traffic has partly outcompeted railways. Riga International Airport is the largest in the Baltic States, offering convenient connections both eastwards and westwards. There are no domestic flights, however, as Riga is now effectively Latvia’s only passenger airport.
Buses are the primary form of transportation to go from Riga to Western Latvia (e.g. Liepaja, Ventspils) where trains are non-existent or few and far between. They are also used to go the other Baltic capitals (there are no train routes), although here the direct flights provide a good, although more expensive, alternative. International buses and flights are often priced the same way – the earlier you buy, the cheaper you may buy a ticket.
If you are going to Riga from the other side of the Baltic sea, you may also choose ferries which transport both passengers and cars from Germany and Sweden.