Valja, nobody knows the formula, I don`t even think stephen knows the formula. It might even be random, I don`t knows. All I know is that the loyalty is based on population, it might average out based on each person counting for the amount of loyalty that that planet has. Not sure how to explain it exactly.
But yeah seifer is right, if you kill all the pop on the low loyalty planets\clusters than the made cluster will have the loyalty of the high loyalty planet\cluster (the one with pop on it).