A lot of sites are hosted in countries where the internet is not closely monitored. A lot of countries (usually poorer ones) do not have the resources available to track down the host and some countries just couldn't care less. Most illegal sites, like torrent sites, are hosted in countries where internet security is lax, or there isn't any internet security of any flavor.