Shanghai has four real seasons but none of them are gentle. Spring (April-May) and autumn (September-October) are the best times: warm days, manageable humidity, blossom or autumn light. Summer is brutal — June through August averages above 30°C with crushing humidity, and late August to September is typhoon season. Winter (December-February) drops to a few degrees above freezing and feels colder because of the damp; it almost never snows but a heavy coat is essential.
The biggest event is Chinese New Year (late January or February), which empties the city as everyone travels home and shuts most non-tourist businesses for a week — atmospheric but inconvenient. Other festivals worth timing for: the Longhua Temple Fair in March, the Shanghai International Film Festival in June, the Shanghai Biennale (autumn of even years), and the Mid-Autumn Festival in September-October. Avoid the National Day week (1-7 October) when the rest of China descends on the city's sights.