The rail connections there aren't great. (For historical reasons, the railway lines tend to point towards Moscow, rather than to each other.)
You can get (slowly) from Warsaw via Białystok to Kaunas and Vilnius, with a single change at Mockava on the border. There are no direct trains from Lithuania to Latvia. And the journey from Riga to Tallinn is quite indirect. Probably only worth it if you want to visit Tartu.
Buses are very good, and I used the bus from Tallinn to Riga, and Riga-Vilnius. About 4.5 hours each. I used Lux Express, but there are other operators.
Here's a useful guide to the journey:
Poland-Lithuania https://www.seat61.com/trains-and-routes/warsaw-to-vilnius-by-train.htm
(That page also has links to the onward journey to Riga and Tallinn.)
I was there a couple of months ago. Any questions, please ask. They're all really interesting countries and cities. Worth the effort.
My other tip would be that the Polish Eurocity train that runs to the border at Mockava isn't great. It's old and rattly, with very limited catering. I can't imagine spending the full 9 hours from Krakow on it! (The Lithuanian train after the border is very modern though).
So I'd recommend taking a decent Polish intercity train as far as you can - maybe to Białystock - then switching to the Eurocity there.
I saw on Twitter today that direct trains are restarting between Riga and Vilnius from 27 December. There’s no schedule published yet.
https://www.lrt.lt/naujienos/eismas/7/2121997/pirmasis-keleivinis-traukinys-is-vilniaus-i-ryga-pajudes-dar-siu-metu-gruodi
Thank you very much, really!
This was very useful information.
In addition, many of the trains in the Baltic are not in the rail planner app because the railways there simply don't share their timetables with the rest of the world, so you'll have to look up timetables on their own websites. But the rail planner app should not be used to plan anyway, since it's not reliable enough.