Often, it's related to some kind of energy or power source. In certain time travel train young adult novels, there's a specific engine or power within the train - like structure that enables it to break the barriers of time. The characters might need to figure out how to control this power to travel to the right time. They may also need to follow certain rules or face consequences if they break them, like getting stuck in a wrong time period or causing disruptions in the time continuum.
Some novels depict time travel as a result of a scientific experiment gone wrong or right. The train itself could be a product of this experiment. For instance, the train might have been built with special materials or technology that allows it to travel through time. There could be a control panel on the train where the characters input the time and place they want to go. But it's not always smooth sailing, as they might encounter unexpected time - related phenomena during the journey, like time loops or parallel time lines.