Pirates have friends and foes. King Henry III of England did something that changed piracy forever. He invented the letter of reprisal, some times called a Letter of Marque. A pirate who held one was a privateer and could attack enemies of their home country. Pirates had become a defacto navy! One country's privateer hero is another's pirate villain. Spain hated the efforts of Drake and Hawkins, who were knighted by Queen Elizabeth I. The Hanseatic League and the Clique Ports were formed to fight off pirates.
What could happen to a pirate? Very few lived to an old age. If one was caught, he or she could expect to be executed. In the Golden Age, the norm was hanging, with their body hung in a giblet afterwards, as a warning to others. This looks to not be the case for the Middle Ages. The most common form of execution was beheading.
This concludes A beginner's guide. All six parts are from my handout "So You Want to be a Pirate," from my SCA class of the same name.