For Machu Picchu best season is between June and September. From June to September the mornings are warm with brilliant sunshine. But it is different at night. At night it can get quite cool. At night temperatures can drop to 10ºC. You know it is summer in northern America and Europe , but in Peru it is winter. So you have to be prepared for the cold temperature in Peru. Some time temperature goes below zero degree at night in those months.
May to September temperature is a bit high. It is at low 50s at night and at upper 80s during the day. Because of the exposed location, it can get quite hot in Machu Picchu, don't forget the height! So at the top the sun is really strong. So do not forget your sunscreen!
Rainy days are common in Peru and same in Machu Picchu. From from December to April showers and downpours are common, followed by bright, intense sunshine. So if you come on in one of these months please don't forget to use umbrella. You need raincoat too. You may buy raincoat from cusco or in Machu Picchu. They are cheap. Cheap ones are not that good quality though.