There are two companies running trains from Praha to Brno: RegioJet (regiojet.cz, be careful because they do buses too) and České Dráhy (or ČD; cd.cz). I prefer the first one, as they are usually cheaper and more luxurious.
You can buy tickets from their websites or apps in advance, which I recommend -- the trains get full quickly, and you can always return the ticket for a full refund up to 15 minutes before departure.
For RegioJet, you have to reserve a spot on a specific train. For ČD, you can reserve a spot, but even if you miss the train, the ticket is valid for any later one that day. Also for ČD you need to show a QR code they send you on email (on phone is ok), for RegioJet you don't need to show anything.
Last thing, this app searches all the public transport in Czechia, you may find it handy to find your way to the train station: https://play.google.com/store/apps/details?id=cz.fhejl.pubtran (Google maps generally don't have all the public transport, they work reliably only in Prague.)
PM me if you have more questions!
EDIT: For city public transport, it's best not to bother with apps and just buy paper tickets, they are time based (check the app for the length of your journey), you can buy them in machines or news shops. You have to validate them by inserting them into the yellow machine inside the bus.
EDIT 2: Oh, also forgot to mention that in Brno, the tickets are time-based and the same for the whole area, not just the city. You can know which is the correct one by the app I linked (it shows you the price).
And also, if you happen to be a student and have a ISIC card, you can get a 75% student discount for all inter-city public transport!
EDIT 3: Last thing: on the behalf of all Brnians, I apologise for the current state of the railway stations.
Check out app called Nesnezeno, every day they share meals/food which wasn't eaten and would be thrown away, you can find some delicious cheap meals there. https://play.google.com/store/apps/details?id=com.lunadio.nesnezeno