Brazil's high season runs from December to March. This is when the country fills with both foreign visitors and vacationing Brazilian families (school holidays run from mid-December to Carnaval, usually in February). Prices rise during this time and you'll face more crowds, though this is also the most festive time in Brazil. Brazil's low season runs from May to September. With the exception of July, which is also a school-holiday month, this is the cheapest and least-crowded time to visit the country though it can be utterly vacant in some resort areas and cold in the south.
During the summer, which runs from December to February (school holidays coinciding), Rio and the Northeast have temperatures in the high 30s. The rest of the year temperatures are generally in the mid-20s to low 30s. The south has wider temperature variations, ranging from 15°C in the winter (June through August) to 35°C in the summer.
The Amazon region rarely gets hotter than 27°C, but it is humid there, with considerable rainfall over tropical Amazonia. In some parts of the North, December to March is considered winter, since that's the rainiest season.
Owing to generally temperate weather year-round, there's no bad time to visit Brazil. But unless you have your heart set on attending Carnaval, you may want to avoid the summer crowds (and heat), and visit from April to November. Treks into the Amazon and the Pantanal are best then - especially from June to August, when it's drier.