Someone should really sticky a post about this.

Tradeports generate income in every system you put one in. The amount of income is determined by the longest unbroken trade route (systems connected together by tradeports without a broken link in the chain). The simplest way to deal with them is to say that they're awesome, and to put one at every planet/asteroid you control. On large maps, its possible to get a trade network so large that it generates more income then taxes, but even on small maps they generate significant credit income.
Refineries only work in their own system, and directly connected (IE: one phase jump) systems. They increase the income from extractors in those systems. Any given extractor can only "service" three refineries at once (shown as a refinery quota on the extractor's info card).
The best places to build refineries are at planets with a lot of resource nodes (Volcano and Frozen), or in systems that connect to several systems with lots of resource nodes. They're not worth building at a Terran planet where the only adjacent system is a dead asteroid (grand total of two nodes in range of the refinery).