Destroying the pirate hideout is one of the possible missions that lead to the rank of Alderman. You can accept the mission under the Alderman's Office menu in the Town Hall of the hometown of the current alderman.
You will get a map marking the location of the hideout and will have 1 month to destroy it.
When you approach the marked place, a black dot will appear that you can attack like any other cities if you were a pirate. When you enter the hideout you will find a settlement with a Tavern in the center and different amounts of half-timbered houses around it indicating the size of the hideout. Defending forces consist of around 8 ships (of different types) and 1-3 port towers. You have to sunk, capture or flee all the ships then destroy the towers.
You can flee from the hideout and reenter as many times as you want. If you reenter immediately the pirate ships will remain in the same condition, so You can easily destroy the pirate fleet with a single ship and some good maneuvering by attacking along the side of the map and fleeing from unfavorable situations. Destroyed port canons also remain destroyed, but the damaged ones will be fully repaired each time you enter the hideout.
A good tactic is to create a small convoy (2-3 ships) from fully armed and manned crayers or hulks to manually destroy all the pirate ships by multiple reentering. Then, with a second convoy consisting from many fully armed cogs (best maneuvering abilities) to destroy the port canons either manually or by letting the computer to do the work. If you do this manually it is good to know that you can anchor ships by putting the little sailing ship icon on the speed slider (above the graphic that shows the ship's weapons) to zero. This way (without dangerous pirate ships) you can anchor your fleet out of the port cannon's range and use only a few cogs for attacking by hand, so if one of them gets hit, you can swap it to another anchored one still being in great condition.
The port cannons always shoot in front of the ships. Before the tower shoots it calculates where the ship will be on impact, based on the ship's direction and speed at the time of the shoot. So the best way to avoid the hit is to sail as fast as possible and after the cannon shoots change direction immediately. This is easier to do when the ship is far away from the tower, but you have to keep in mind that the tower has a bigger range then any of the ships weaponry. Wind direction is an important factor too. You should wait until the wind changes, so it blows in a direction that lets your ships to sail mostly parallel to the coast so you can get in and out as fast as possible.
You can use multiple ships to attack the same tower, but it is best to order them into a queue with some space between them so they don't collide during maneuvering and also protect each other, because while an incoming ship is being targeted, a leaving ship can sail safely and vice versa.
After you destroyed the last tower, the mission will end and an animation will be played for the event. Unlike attacking regular towns, You don't get goods from attacking a hideout, but You do receive the freed up gold and get a chance to capture their ships. The amount of gold received depends on the size of the hideout. Smaller ones reward around 100000 bigger ones can give above 1 million.