i'm not sure everything said in here is accurate. don't take my word a gospel though, go test it out.
the impression i have for how ports work is like this, based on my informal observations:
-the income that each port generates is a constant value regardless of where you built it. being on the white highlighted route doesn't actually mean that those ports make extra income.
-the longest route determines the rate each port in your empire generates. it starts off low (something like 1.0 cred/sec for length 2) and scales up to much higher (i've seen rates of 1.9 cred/sec per port for length 6), based on the length of the longest route (which is what the white highlighted path represents).
-alliegance has no effect on ports.
-i still have no idea what happens if a cargo ship gets shot down. doesn't appear to impact the port income though.
regarding Refineries
the issue with refineries is not their effectiveness but their initial cost. they can be prohibitively expensive to develop. they are also extremely location sensitive. trade ports can be built anywhere, but refineries are only good investments in specific locations. generally you'll need a refinery to be in range of at least 8 resource asteroids before its worth building. this is not a situation that comes up alot, but when it does you shouldn't hesitate to build to spam the full compliment of 3 refineries at the good location.
you can easily boost crystal income by 2 crystal/sec or more with well placed refineries. considering that if you were to buy crystal from the black market you'd spend about 5 creds per crystal you can view that level refinery income boost as being nearly equivalent to 10 creds/sec, which is about as much income as you'd get from 6-8 trade ports. the conclusion is that when you've got a good location for them a refinery is about as good as 2 trade ports.
however...once you're on surpluses the black market sale value for the extra resources is only half as good as the "didn't have to buy from black market" value you get from just spending your extra resources directly as opposed to cashing them in. moral of the story is this: if you've got a good spot go ahead and build the refineries and dump the resource income directly into research techs. otherwise, just build trade ports and buy resources on the black market as necessary.
Advent is a different story entirely. they don't do refineries, and resource focus is super bad. just ignore it.