If you're coming by train to Modena, then you have to take a bus to the bus station and then a bus to Maranello.
Take a bus from the Modena bus station. The bus to Maranello leaves every 1 hour and takes about 30 mins. Be sure to ask the driver to stop near the Ferrari museum.
The new Maranello bus station is near the Ferrari factory main entrance, but on the opposite side from the museum 1 mile far.
For Ferrari museum tickets owner there is shuttle that connects the Ferrari museum in Maranello, Enzo Ferrari museum in Modena and Modena's train station.