There are two options for your return trip to Cusco. The most popular and safe option is the train. The second, and more affordable option, is by car.
By train: There are two options if you chose to travel by train. The first is from Machu Picchu town to Cusco (about 4 hours of travel) and the second option is from Machupicchu Town to Ollantaytambo (about 2 hours of travel). From the station in Ollantaytambo, it is very easy and affordable ($4 USD) to find a car that will take you straight to Cusco (in total, about 3 ½ hours of travel)
By car: If you wish to return by car, you must first walk for 3 hours from Machupicchu Town to the hydroelectric power plant. At the power plant, there are cars waiting to take passengers to Cusco. The price to get to Cusco is about $20-25 USD and the trip takes around 7 hours. The disadvantage of returning to Cusco in a car is that you will have to leave the archaeological ruins of Machupicchu no later than 10am.
Please note: this option is only available from April to December. From December to March, this option is not recommended due to levels of high risk.