On our trip to Italy in 2015, I reserved all our train tickets in advance, thinking by analogy to airline tickets and hotel rooms that I was locking in the best prices ahead of time. That turned out to be totally unnecessary, as Italian train tickets seemed to cost the same whether you book 6 months in advance or just walk up to the ticket counter on the day of travel.
Having learned from that experience, on last month's trip to Europe I didn't book any of our train tickets in advance, planning to maintain flexibility in case we wanted to spend more or less time in a particular city. That worked great until we got to Germany.
Buy at least a day in advance
Unlike the Hungarian and Slovak trains we took, the German national railway service Deutsche Bahn offers multiple fare types on many of their trains. The price differences aren't always very large, but if you don't know about them you might find yourself overpaying. Here are the fare options for a non-stop train from Vienna to Berlin:
Here's the train we actually took from Vienna to Regensburg to visit my partner's relatives in Bavaria:
And here's the train we took from Schwandorf to Berlin:
While the fares are reasonably close, the fixed-date and fixed-routing tickets purchased in advance would save 36.50 Euro per ticket on our routing, or 28.50 Euro per ticket on the nonstop routing.
So if it's at all possible, buy German Deutsche Bahn train tickets in advance!
Like coach class tickets on Amtrak, second class tickets on Deutsche Bahn do not come with assigned seats. However, for an extremely modest charge (4.50 Euro on a sample trip), you can request a reserved seat.
You can decide whether or not this is confusing (we were extremely confused), but reserved seats on Deutsche Bahn trains are indicated by a pair of cities listed above each pair of seats. For example, seat 65 on this train is reserved by someone boarding in Leipzig and leaving the train in Hamburg:
In other words, if you are departing the train before Leipzig, or boarding after Hamburg, you're free to sit there. If you are sitting there between Leipzig and Hamburg, you'll have an irate German standing by your seat angrily gesturing at his ticket and at the digital panel above your seat.