Indonesia's peak tourism season coincides with the middle of the dry season and European summer. A second, lesser peak season stretches across the middle of the monsoon season in December and January when, in particular, Australians flock to the country for their summer holidays.
When to visit depends somewhat on your interests. If you plan to climb volcanoes, dry season is better, with some peaks being closed to trekking at the height of the wet season. If you're a surfer, much will depend on where you are planning on surfing. If you're after a more typical holiday break, we'd suggest the shoulder of the dry season -- to get the best of the weather before half of France and Italy arrive (or after they've left).
If you're planning on visiting in wet season, be prepared for a lot of waste in the water and some seriously filthy beaches. Indonesia is under (a largely self-inflicted) siege by waste, and while we imagine "surf Kuta in a sea of used nappies" probably isn't a slogan the tourism department would be fond of, it isn't far off the truth.