The only trains you need to book in advance are fast trains between large cities. Other tickets are generally local trains called regionale that don't change price and don't sell out so only book them as you need them.
The two companies that run fast trains are Trenitalia which is the state train company that also runs local trains and the private Italotreno - aka .Italo - that only runs certain fast trains. They both have tiers of service and they are pretty equal in terms of comfort and travel times.
https://www.trenitalia.com/en.html (use Italians names for cities eg Firenze and Roma for best results)
https://www.italotreno.com/en
Both come with specific reserved seats and buying tickets in advance can save you money - sometimes significant amounts. However, early tickets come with restrictions in terms of changes or cancellations so you can only get full flexibility by paying full price. Given the hassle of making changes if you aren't willing to stick to a time you should wait until you're ready to travel to buy tickets because you pay full price either way. Fast trains rarely sell out - like on big holidays - so there's generally no reason to buy ahead and pay full price.
Both companies have phone apps and I recommend at least getting the Trenitalia one to book local trains and check schedules as you need them.
The Man in Seat 61 is a wealth or in depth knowledge of trains in Italy and Europe.
https://www.seat61.com/Italy.htm
Hope that helps,
=Tod