Hi Elva and welcome to our community. That's a good question that many travelers ask us. Generally speaking, you can just buy a ticket right in the train station prior to departure. The only time this might not be advisable is if you were trying to get a seat on a really busy commuter train during the week, something like Rome-Milan, where there's a chance that it would be all booked up during a rush-hour situation.
In the case of Venice airport to Ravenna, that shouldn't be an issue. Granted, the train doesn't go to the airport, so you'd need to get to the train station in Venice by shuttle bus13 from the airport and then get the train from there to Ravenna.
You can search for pricing and schedules on our site ItaliaRail9, to get an idea of what's available on the date you'll be traveling.