You can purchase a ticket online ahead of time via Trenitalia website, at the ticket booth at the train station from an employee, or at one of the free standing kiosk ticket machines at the airport. If you purchase your ticket online then you do not need to validate your ticket.