The train is separate
Ollantaytambo, Aguas Calientes, and the bus that is not inside the entry price.

Our ticket is the citadel. It does not get you to the valley, and it does not get you up the road. The usual route is a train from Ollantaytambo to Aguas Calientes, then the bus to the gate. Cusco has trains too. They take longer and they cost more. Exact departures change. Check them before you lock an entry hour.
Town, then the hill
Aguas Calientes is Machu Picchu Pueblo. The station is in town. The bus starts there and climbs to the gate in about half an hour. Buy that seat as its own ticket. Walking the road is allowed and it is a real climb, not a shortcut you should invent on the morning of the visit. The return is the same bus, then a train back down the valley.
Put the hour first
Pick the entry hour, then the train that arrives before it with room to spare. A late train does not move the ticket. If you want us to look at a mountain route as well, say so. We will tell you whether it is still for sale. We will not add the train to the same invoice unless you ask, and even then it is a separate purchase in your name.