Machu Picchu needs little introduction—it's South America's most famous and most visited travel destination. Getting to this complex of Inca ruins, as almost every Peru-bound traveler wishes to do, always involves first traveling to Cusco.
Cusco is accessible by plane internationally from Bogota in Colombia, La Paz in Bolivia and Santiago in Chile by direct flight. However most people come by direct flight from Lima, with other flights arriving from Peruvian hubs Arequipa, Puerto Maldonado, Juliaca and (seasonally) Iquitos and Trujillo. Cusco can also be accessed by road from Lima, Arequipa, Ayacucho, Nazca, and Puerto Maldonado.
Once in Cusco, there are two key ways to get to Machu Picchu: by train or by hiking. There is no drivable road to Machu Picchu or to Aguas Calientes, the town nearby. With either the train or hiking option, buses can help by taking you for some of the way, which saves on cost or on time.
Remember that however you travel, you need a ticket to the ruins to reach your end destination. Tickets for Machu Picchu itself are best purchased well in advance of your travel dates.
In Cusco, you can take either a train direct, or a bus-train combo that switches to train at Ollantaytambo to the town of Aguas Calientes, at the foot of Machu Picchu. Once there, you will need to take either a 25-minute bus or 2.5-hour hike to the entrance of Machu Picchu. See this article on How to get from Lima, via Cusco, to Aguas Calientes by train.
Once in Aguas Calientes, buses to Machu Picchu leave from right next to the train station. Buses depart every five to ten minutes from 5:30 am to 3:30 pm.
Trekking is a very popular way to reach Machu Picchu: routes with Machu Picchu as their final destination are typically between one and five days in length.
These hikes fall into two categories: those for which a guide is obligatory and those for which a guide is optional but not obligatory. The classic Inca Trail falls into the first category, while other treks such as the Salkantay Trek fall into the second category. In any case, all these treks can be booked in advance with a local travel specialist.
With the classic Inca Trail, you will need to book a slot many weeks or months in advance. With the other hikes, you will need to book them at least a day in advance (if you require a guide) and ideally more to make the planning simpler.
Note that none of these hikes start from Cusco: all involve a trip by bus to get to the hike start point. Going with a tour, transport to the hike start point is included. Going independently, you will need to make your own way to the hike start point.
See this article for more on the classic Inca Trail and the best alternative treks to Machu Picchu.