Why do ships sail under flags of convenience?

The recent seizure of oil tankers in the Persian Gulf has raised questions over what common shipping practice entails.