Life in general in the 16th, 17th, and 18th centuries was hard, and death was often sudden. Anyone could die from disease, and many people fell in battle, were lost in shipwrecks, starved, died from exposure, were killed in brawls, or died unexpectedly in other ways. For a pirate the most common ways to die were in battle, or tavern brawls, or to drink oneself to death. If one survived all of that there was always 'Dancing at the end of a rope', or 'Dancing the hempen jig', as they called hanging. This was the fate of anyone tried and convicted of piracy. There was no parole, no appeal, and no hope. The few instances where a convicted pirate escaped the noose involved pregnancy (Anne Bonny, and Mary Read), or direct intervention of the crown for reasons of national interest(Henry Morgan).
Pirate Trials were held in the Admiralty Courts. These were special tribunals that had been established in the 1340ís in England. They dealt exclusively with crimes committed beyond the high water mark. Sometimes the courts would allow a member of a pirate crew to betray his freinds and testify against them on behalf of the court. For this service a pardon might be granted, but only after the entire crew, including the turncoat, had been convicted. Frequently the pardon was forgotten, overlooked, or simply never arrived, and the traitor was hung with his former comrades. Once a conviction had been handed down there was only one punishment for piracy, and that was hanging. The sentence could be carried out anytime starting ten days after the trial.
When the day of the hanging arrived the condemned men were taken in a procession to the gallows. They were lead by an officer of the court carrying the Silver Oar, the symbol of the High Court of the Admiralty. The gallows were usually in a public place near the water, or at the low tide mark. Hanging was a public spectacle, and drew large crowds.
While the condemned waited with the rope around their necks a chaplain would give a sermon. He would urge the convicted to profess their faith and repent, before they met their maker. Often he would preach to the audience using the pirates as examples. Then the pirate was allowed to speak. Some men were repentant, and some frightened. Some begged for their lives, and some cried. Others were unapologetic, surly, angry, and some cursed or spat at the crowd. Some appeared in good humor, telling crude jokes to the crowd. After the pirate had his last words the cart was driven from underneath him and he was hung. This was the old style of hanging where death resulted from slow strangulation, and suffocation, not the later method in which the neck is snapped.
Following the hanging the bodies of the insignificant would be buried face down below the high water mark. Some might be left hanging until three tides had passed over them as an example to others. The most famous and notorious were often covered in tar, placed in a 'crows cage', and hung from a gibbet. this was usually in a noticeable place by the waters edge. There they hung, rotting away, until nothing was left. This served as a very graphic example to anyone contemplating the idea of piracy.
While most nations followed the English example, in Spain, and her colonies the Inquisition often tried non Catholic pirates. Torture was often employed, and death could be extremely long and painful.
The official punishment for privateering was prison. There was always the possibility of being released in a prisoner exchange. This was not always a better fate than that of a pirate, as prison often meant a slow and painful death. Prisons were usually dank, and disease ridden. They could be Prison hulks, which were converted naval ships, or land based jails. Hulks were often leaky, less than sea worthy, and prone to fire. Often one's captors wouldn't recognize a rival nations letter of marque, and simply treated privateers as pirates.