The Flying Dutchman spawns once a Pirate Invasion passes 50%. How to start the invasion, get a Pirate Map, make the ship appear, break its cannons and farm its drops.
The Flying Dutchman is the mini-boss of the Pirate Invasion in Terraria. You summon it by starting a Pirate Invasion with a Pirate Map, or waiting for one to happen on its own, and then fighting until the event's progress bar passes 50%. From that point a Flying Dutchman can spawn wherever there is enough open space.
It is a ghostly pirate ship that floats above you with four cannons. You beat it by destroying all four cannons, and it can appear several times in one invasion, or not at all if the space is too cramped.

Notable drops:
A Pirate Invasion is a Hardmode event. You can start it two ways:

Pirate Maps have a 1% chance to drop from most enemies killed in the surface Ocean during Hardmode. The enemy must be within 380 tiles of the world's edge and must be one that normally drops coins, so statue enemies don't count. Clearing enemies along the Ocean shore on both sides of the world is the usual way to get one.
The invasion starts at one side of the world, with the message "Pirates are approaching from the west!" or from the east, and moves toward your spawn point. Once it says "The pirates have arrived!" the fight begins.
In single player you need 180 kills to finish the invasion. The Flying Dutchman counts as 10 of those, and the Pirate Captain as 5. It can only spawn when:
Fight in an open area like a big flat field or a skybridge. If you are in a cramped spot such as your base or a tunnel, the ship can't appear at all. After you kill one, another can spawn as long as the invasion is still running.
The ship hovers about 26 tiles above you and can't be damaged directly. Its four cannons are the targets: each has 2,000 health in Classic, 3,400 in Expert and 5,100 in Master, with 20 defense. The cannons fire explosive cannonballs at the nearest player, and the ship drops regular pirates from its deck onto the ground below.
Don't run too far away. If you leave it behind, the Flying Dutchman despawns and you lose your chance at its drops. It also can't move down through platforms.
Note: Killing the Flying Dutchman does not end the invasion. If the event finishes while a Dutchman is still untouched, it explodes, but one you have already fought stays around until you destroy it.
Every Flying Dutchman drops one piece of golden furniture. It also has these chances:

Master Mode adds the Flying Dutchman Relic and a 25% chance at The Black Spot mount. The Lucky Coin, Discount Card and Gold Ring also drop from regular pirates, but at far lower rates, so the Flying Dutchman is the best target when you farm them.
Once the bar passes 50%, stand a little above the ground on a small platform or a flying mount. Normal pirates that can't reach you despawn after about 12 seconds and keep respawning, while new Flying Dutchmen keep coming to you. This way one invasion can give you up to 10 Dutchmen.
Beating your first Pirate Invasion lets the Pirate NPC move into your town. For other bosses at this stage of Hardmode, see How To Summon Queen Slime and How To Summon The Twins.