Replication priority I have two MongoDB instances running on two servers (instance1 and instance2) and they are configured as a replica set. Instance1 is the primary and instance2 is the secondary.

When instance1 was shut down, instance2 became the primary. However, they both had priority value set to 1. Therefore when instance1 was up again, instance2 kept being the primary node. 

I changed the priority value of instance1=2 and instance2=1. If instance1 is shut down again, instance2 will become the primary. When instance1 is up again, will this new priority setting make sure that instance1 becomes the primary again?
Yes, giving instance1 a higher priority will make the replicaset re-elect instance1 as the primary when it rejoins. See the docs on Adjust Priority for Replica Set Member and Replica Set Elections for more details:

Member Priority
After a replica set has a stable primary, the election algorithm will make a “best-effort” attempt to have the secondary with the highest priority available call an election. Member priority affects both the timing and the outcome of elections; secondaries with higher priority call elections relatively sooner than secondaries with lower priority, and are also more likely to win. However, a lower priority instance can be elected as primary for brief periods, even if a higher priority secondary is available. Replica set members continue to call elections until the highest priority member available becomes primary.