The ship will offer a bus to take you into downtown Livorno where you can take a taxi to the train station. The taxis waiting at the ship are reluctant to take anyone to the train station as they are looking for full day tours. It is no longer possible to walk out of the port and grab a taxi at the entrance. There is a nominal charge for the bus into downtown Livorno and there is a taxi stand just a block from the square that you are left at.
Hope that helps.