Let us look at the facts: C3PO was built out of parts by none other than Anakin Skywalker (aka Darth Vader).
As our storyline progresses, they are separated as Anakin gets trained as a Jedi. At some point, C3PO is lost track of and in Episode 4, he appears on the ship of the Princess.
Now is where it gets interesting. R2D2 is definitely looking for Obi-Wan and as Luke states “I think he's searching for his former master...I've never seen such devotion in a droid before...there seems to be no stopping him.”
It appears there is some sort of built in devotion in droids that brings them back to their masters. With this being the case we can assume that C3PO has the same sort of devotion.
More Facts: C3PO never sees Darth Vader in Episode IV. He walks through the hall of laser fire and never catches eye contact.
In The Empire Strikes Back, C3PO is blown up on Cloud City and the one opportunity he has of seeing Darth Vader, he is strapped to Chewbacca’s back and states “turn around, I can’t see”.
Why would Lucas put that line in there unless he wanted to give a clue that C3PO’s devotion chip would kick in and he would align with Vader.
The last clue is given when at the end of Return of the Jedi, C3PO (the golden God of the Ewoks) is telling stories of the greatness and magnitude of Darth Vader (including mimicking his breathing).
I believe that if Episode 7 ever comes out it will be solely based on the exploits of C3PO as Lucas has always meant this to be the true emphasis of the characters he has given to the world.
Thanks for reading and any comments are welcome.