TEC and VasariEdit
TEC and Vasari refineries work by sending out ships to adjacent planets and increasing production at the extractors there. The TEC use a special refinery ship, the Vasari just use a trade ship with a different name.
Each refinery servicing an extractor at one of your planets earns it an extra 0.06 metal or crystal/sec. Extractors on Ferrous planets instead provide refineries with 0.066 metal/sec, those on Barren provide 0.054 metal or crystal/sec, and those on Ship Graveyard provide 0.085 metal or crystal/sec. Each extractor on colonizable planets can be serviced my a maximum of 3 refineries. Saturating your empire with refineries increases your income by roughly 45%. Refinery income is not affected by allegiance.Each refinery servicing one of your extractors at uncolonizable planets earns it an extra 0.08 metal or crystal per second. There can be a maximum of 4 refineries servicing one extractor. Extractors on Shattered Moons instead provide refineries with 0.06 resources/sec and can be serviced by only 3 refineries (just like those on most colonizable planets). Refineries cannot service extractors on Comets and Ice Fields.
It can be a mini-game unto itself to place refineries most efficiently. Here is an example:
The optimal strategy here is to place three refineries at A and three refineries at B. This will cause each planet to be serviced by exactly three refineries. This is, however, a very simple layout, and there will often be no perfect way to place them.C | A--B--F | E
A somewhat good way to place them without worrying about optimality is to just put one per planet. That's simpler, but doesn't work as well.
Another way to do it is to look for a planets that have several planets near them and place three there
Advent refineries work differently than the other races. Advent trade ports can be toggled into refineries, losing their trade port effect. They then boost resource extraction at only the planet they are built at by 8%, upgradeable through research (17% and 25% respectively, although 7 Temples of Harmony are required). They stack with regards to each other, as expected, additively.
Since the bonus is a percentage of the current extraction rate, it is affected by allegiance. A trade port will make you a minimum of 1.0 credits/second at normal speed. At a planet with 100% allegiance, a trade port in refinery mode providing a 25% bonus grants you an increase of 0.1 crystal or metal per extractor per second, also at normal speed. Assuming a standard value of 5 credits for each, we arrive at an equivalent of 0.5 credits/second per extractor.For the extraction increase to be worth the lost income you need a minimum allegiance.
As you can see, it's not really worthwhile unless you have either three or four extractors and have researched to get the 25% boost (which as mentioned requires 7 Temples of Harmony). The metal/crystal refine rate increases from the tech tree are additive to your total, so they don't have an effect on the trade-port-as-refinery metric.
Having a long trade route will also increase trade port income, but will not affect resource focus at all. The longer your trade port chain, the higher the loyalty levels required for resource focus to be worthwhile. The numbers do change a bit if you happen to have a metal and/or crystal bonus on the planet/asteroid in question, as that value multiplies by the above (as does the allegiance modifier), but the conclusions are still much the same: You're normally better off having your trade ports in trade port mode operation.