The best time to visit Bali is during the dry season between May and October, when the weather is best for sightseeing, surfing, chilling at the beach, snorkeling, and diving. April, May, September, and October are the best months, the weather is great, it is not the peak season yet and the rice fields are at their greenest and most vibrant. During the peak season of July and August it can get quite crowded and overpriced.
The wet season is much quieter, accommodation is cheaper, and the countryside is lush and beautiful. But be prepared for at least a few hours of rain a day.