For the record Male Homosexuality under the very rare conditions that every one talked about above could be punished by stoning. Women who were unfaithful to their husbands, as well as the man that sinned with the married woman, faced a different type of death penalty.
People, who were sentenced to death by stoning, were usually killed by throwing then down from a high place. Only if they survived the fall, were they finished off by a stone or stones.
Concerning King David. The majority of rabbis do not believe he was guilty of adultery but rather a different sin. But even those that held it was adultery, hold that not all the legal requirements were in place, in order for the court to give him the death penalty.