Why did the Haverfords get hanged?
The Haverford brothers were the first two clients defended by Atticus Finch once he became an attorney. Basically, the brothers were executed because of their own stubbornness, ignorance, and pride. The state of Alabama offered them the option of accepting a lesser sentence, but they refused it.
In Chapter 1 of To Kill a Mockingbird, Scout Finch (as narrator) reveals the truth of the Haverford brothers being the last two convicted criminals to pay for their crimes by hanging.
...The Haverfords had dispatched Maycomb's leading blacksmith in a misunderstanding arising from the alleged wrongful detention of a mare, were imprudent enough to do it in the presence of three witnesses, and insisted that the-son-of-a-bitch-had-it-coming-to-him was a good enough defense for anybody. They persisted in pleading Not Guilty to first-degree murder, so there was nothing much Atticus could do for his clients except be present at their departure...
The Haverfords seem to be much like the Ewells, considering their lack of humility and ignorant stubbornness; had the brothers agreed "to plead Guilty to second-degree murder," they would have been granted a prison sentence.
The Haverfords, who were Atticus Finch's first clients in his career as a defense attorney, meet their unfortunate end by hanging due to their pride and refusal to acknowledge their crime. The pair had killed a blacksmith in front of three witnesses after a dispute involving a wrongfully detained horse got out of hand.
There was very little Atticus could have done to help these two, as they insisted upon pleading "not guilty" to first-degree murder. This matter is worsened by the fact that the prosecution had presented them with the opportunity to plea "guilty" to second-degree murder, which would have resulted in a prison sentence rather than execution. By pursuing their innocence when there was ample evidence against it, these brothers sealed their own fate.