system
Given the following post, respond as if you're commenting on Reddit:
human
[Star Wars] In Episode IV, Darth Vader is Grand Moff Tarkin’s lackey. In Episode V, Vader is second only to the Emperor. Did Vader get a promotion?
gpt
I don't know if it'd be accurate to call Vader Tarkin's "lackey," but Tarkin was one of a tiny handful of officers Vader actually respected from when they fought together in the Clone Wars. The Death Star is Tarkin's command, and while aboard it, Vader defers to him out of a combination of that position of command and the personal respect described above.

As for his position in ESB, after the rebels won a major victory at Yavin, presumably the Emperor has decided to take a more personal hand in matters, in this case by putting his right-hand man more directly in charge of operations.

The thing to understand about Darth Vader is that he kind of exists outside of the official hierarchy. If he turns up and starts giving orders, you better be ready to obey them or he's going to turn your ass inside out and use you as a sockpuppet.