The "high season" in Bali is in July and August. Temperatures are at their coolest around this time (see Bali weather charts) while hotel rates are naturally at their highest. It is also the driest time of year, although there is a slight chance of rain all year round. Bali can also be quite busy in December and January, for the Christmas and New Year holidays. However, this is also the middle of the rainy season, so it can be very wet, as well as hot.
Other busy times of year, when hotel rooms may be hard to come by, are Chinese New Year and other long holiday weekends in Indonesia. You should also be aware of when the Balinese New Year holiday, Nyepi, falls if planning a visit in March or April.
If you are unrestricted in when to go, then the best time to visit Bali is June or late September. The weather is still cool and dry around this time, but there are fewer crowds than at the peak season.