Currently, loyalty is based on distances from the capital, measured in numbers of jumps. Thus, it is possible that a planet in another solar system may actually be more loyal than a planet in the system you're in now.
The exact numbers are:
0 Jumps = 100% Loyalty. (It's your capital!)
1 Jump = 90%
2 Jumps = 75%
3 Jumps = 60% (As it stands, this is currently the maximum loyalty for any planet in an ajacent solar system)
4 Jumps = 40%
5 Jumps = 15%
6 Jumps = 15%
7 Jumps = 15%
This is as low as it goes, 15% loyalty for any other distance. But that's a killer on the empire-building, and I've been toying with the following ideas:
Loyalty should be based partly on distance, but not entirely. I would however, for the sake of argument, keep the current arbitrary numbers, if only to use as an example.
Loyalty should be primarily based on economics, in my opinion. A planet that is doing well for itself will be much more loyal than one that is not. This can be expressed as many devices, but the most obvious one will be the presence (or abscence) of a Trade Port, and the amount of civic infrastructure developed on the planet. Perhaps, say, a 5% increase in loyalty for each. Additionally, Repair Docks, Mines, Orbital Refineries and Light Shipyards should be worth 2.5% loyalty each, and a capital shipyard should be worth 5%. This is because these are major employment sources, and create jobs - which means more money going into the planet!
So, a Terran planet with a trade port, five jumps away from the homeworld, should have 20% loyalty. With the addition of three Civic Infrastructures, it would go up to 35% - a marked improvement!
Loyalty should also be based on the distance of the world from threats. If the system sees enemy forces on a regular basis, it should not go up - if it gets bombarded, it should take a dive, albiet temporarily. (Say, to the tune of 15%.) On the other hand, if a planet has not seen danger in quite some time, the loyalty should go up, around 10% or so, slowly over time. (Say, after 20 minutes without any hostiles in the system, the loyalty goes up by 1%, and again every further ten minutes.)
Lastly, loyalty can be inspired by a military presence in the system. Whether this is loyalty through fear of subjugation, or loyalty out of love for the mighty weapons and brave sailors who protect them from hostile forces is up to the player's imagination; regardless, a capital ship present in the system should be worth a 5% bonus (and another 5% every time the number present is doubled - IE, 3 Capitals would be worth a 10% bonus, 6 would be worth a 15%, and 12 a 20% bonus, etcetera.) Obviously this gets prohibitive in a real hurry, but hopefully it's not too ardous to station a single capital ship in a remote system. And, lastly, defensive structures. Gauss turrets should be worth 0.75% loyalty each, while a Hangar Defense could be worth 3% each. Phasespace inhibitors shoulden't be worth anything, since they serve to keep hostile forces IN the system, but neither should they impose a penalty, either. Obviously, planetary shield generators are going to be VERY welcome, their presence should inspire 5% loyalty, and they follow the capital ship formula for doubling numbers leading to an additional increase.
So, let's re-visit that far-off world. Now it's had some time to grow, while you were listening to me ramble. The planet is 5 jumps away from the homeworld, thus, it has a 15% base loyalty.
We know it has a trade port, and has had it's civic infrastructure built up, giving it a 35% loyalty rating. It has three mines in system, giving it a 7.5% raise, and a light shipyard rounds it out to +9% economy from orbital structures. It has had a defensive web built up around it's jump-point, consisting of six gauss turrets and two hangar defenses, as well as an orbital shield generator, giving it a bonus of +15.5% loyalty from defensive structures.
So, for those following, that's:
15% base loyalty
29% Economic loyalty
15.5% Security loyalty
For a total of 59.5% loyalty - a MARKED increase. Although this planet is far from the capital, the very high economic development and the strong presence of defensive military has made this truely an imperial planet, no longer a backwater hell-hole. Even if they do see the occasional pirate raid, they're strong and secure in their position as one of the empire's vital assets.