Diacetyl is mostly an issue with lager yeasts and certain strains (mostly English ones like 1968ESB/WLP002 and Ringwood) of ale yeast. Above detectable amounts, it begins producing what some simply call "butter beer".
During ferment, yeast can produce varying amounts of a compound called alpha acetolactate. It doesn't have the butter flavor (it's more of a slick mouthfeel), but it's a precursor to and converts to diacetyl at higher temperatures. Yeast can't eat acetolactate. They can, however, convert diacetyl to some compounds that have a much higher detection threshold (they're present, but you won't taste them).
For lagers, when they get 80-85% of the way towards FG, you simply raise the temp from around 50*F up to about 62*F or so. This causes the alpha acetolactate to go ahead and convert to diacetyl which the yeast can take care of for you.
For ales, you can simply pitch/start the ferment on the lower end of the optimal range, hold it there until activity begins to slow and then begin ramping up the temp so that it finishes at the upper end of optimal.