So who was pulling the Empire's strings in the original Star Wars? And what is the chain of command: is Darth Vader third after Tarkin (second?) and Palpatine?
The Emperor, although unseen and only mentioned in passing in A New Hope, is in overall command of the Empire:
Tarkin: The Imperial Senate will no longer be of any concern to us. I have just received word that the Emperor has dissolved the council permanently.
Given the events of Attack of the Clones/Revenge of the Sith, it seems likely that by this time the Senate was at best an advisory body and probably in reality was there to provide the illusion of democracy.
My take on Vader's position is that he exists outside both the political and military hierarchies (though probably in the line of succession - see below) and acts as a troubleshooter/enforcer/gofer for the Emperor (along with, from the EU, Mara Jade, Grand Admiral Thrawn etc).
The exact hierarchy between Tarkin and Vader isn't made clear from the film - as HorusKol says, they appear to be equals. The EU suggests that whilst Tarkin was in charge of the entire Death Star project, Vader was aboard as the personal representative of the Emperor - most probably to stop Tarkin getting the idea of staging a coup, using the Death Star to assassinate the Emperor.
In terms of the chain of command, the suggestion is that below the Emperor power is held by the politicians
Tarkin: The regional governors now have direct control over their territories.
but there's nothing said about whether they were reporting directly to the Emperor or whether there was a layer of 'middle management'. The military, in the normal course of events, are subordinate to the political hierarchy.
The whole 'chain of command' question raises the question of what would have happened had the Rebels failed and the Emperor not died aboard the second Death Star. The Sith Rule of Two (one to embody power, one to crave it) implies that eventually Vader would have staged his own coup to depose the Emperor (and in fact he more or less tells Luke on Bespin that this is his plan).
Suppose the Emperor had died of natural causes or at least in a non-violent manner - it seems likely that Vader would have been his chosen successor, but after that I think the line of succession breaks down. In the EU when the Empire is left without the Emperor and Vader, it falls apart into a collection of pocket empires and territories held by warlords using military force.
To further elaborate on Tarkin vs. Vader -
Vader was an agent of the Emperor (Cardinal Richeleu had similar ones).
This means that Vader has the ultimate authority as far as enforcing Emperor's commands/wishes (when those collide with Tarkin, Vader would win, such as confronting Obi-Wan in the name of Dark Side of the Force).
Also, from EU, he's more a spiritual thing (I'm tempted to say "inquisition-like" but that's be somewhat inaccurate). He cares about the Force-related aspects of the Emperor's rule.
Tarkin was, as noted in other answers, a high level (from EU, pretty much top level) bureaucrat in the civilian chain of command (to borrow the phrase from modern Russian politics, "the vertical of power").
So, when things are within his jurisdiction and NOT related to some specific item where Vader is about it on Emperor's agenda/orders, Tarkin has the authority, or at least, Vader doesn't have authority trumping Tarkin (the infamous "Vader, release him" may not really be a command, more of a "enough of this junior high school distractions! We got important stuff to deal with!" reminder, merely said with Tarkin's usual command tones).
Reading the original book of the movie shows that Palpatine is a puppet put in place by a cabal, of which Tarkin is a member (kind of like a Politburo setup, I guess). Vader is subordinate to this cabal. The movie plays it more like Tarkin and Vader are equals - though Tarkin does seem to be slightly ahead in terms of control.
Mind you, this quickly gets re-written in the subsequent movies, making Vader a direct subordinate of a powerful Emperor who is a force-user.
To make things muckier - at the end of the final prequel movie:
it is clear that Palpatine is very much in charge of things, and Tarkin just can't come between Vader and Palpatine - having to excuse himself when the other two come together to view the Death Star construction.
Lord Vader held several different military and paramilitary titles within the Imperial hierarchy, including that of Supreme Commander. It was as Supreme Commander of the Imperial Forces that Luke Skywalker took up his father's place at the side of a reborn Palpatine, hoping to destroy the Empire from within, and for this reason, Vader can be seen as the prototype of later Supreme Commanders.
Here's my .02 on the matter. The Emperor gained control, and probably didn't want to be mired into the day to day affairs of state. He was focused on obtaining eternal life and increasing his own power with Dark Side. Some resources suggest that he was withdrawn and that Vader and Tarkin became the visible faces of the Empire.
Vader was more of the enforcer/special liason and Tarkin was the administrator and architect of the Imperial Rule by Fear of Force doctrine. Vader and Tarkin did have a history back in the Clone Wars. Anakin respected him, so as long as Tarkin was in line with New Order and was an efficient enforcer. Vader was along for the ride, but still served as eyes for the Emperor.
Tarkin was an Over Sector Moff (Grand), which he had multiple sectors and commanded multiple sector armies. Vader was outside of this ranking. Watch the subtle things in the OT. High General Tagge and High Admiral Motti seem indifferent to the Dark Lord's presence, openly questioning and even Vader reporting progress of the interrogation and search to Tagge and the military committee. In ESB, Admirals and Generals were p@#%#ng on themselves in Vader's presence.
Again, this reinforces the fact that Vader was there to assist GM Tarkin. Also, there was a huge power vaccum when the DS1 was destroyed
I think that back in the clone wars Tarkin and Vader were friends,they both respected each other.I think that Vader/Anikan looked up to him and that is why Tarkin commands Vader in A NEW HOPE...