Stannis fled back over the river to the beached warships(or in this case directly out to sea) and fled back to Dragonstone, the room you see him walking around is the war room from a few episodes ago. When he was being dragged away and screaming "NOOO" that was his own bannermen dragging him back to the ships (though i can see how you might misinterpret that as him being captured). The ending of the battle was a little cut and I'm disappointed they didn't leave us with the Davos cliffhanger or show them fleeing back the the ships.
Tyrion being made hand in the first place only happened because Tywin was raising levies/on campaign and he was totally over the retardation that kept resulting with nobody to keep Cersei in check, the "acting hand" position was meant to go to Jaime while Tywin destroyed the Starks (remember Tywin is the most accomplished general on the continent) but he was captured at the Battle of Whispering Wood.
The position was given to Tyrion out of necessity, because he could do the job and because he was a Lannister rather than as a sign of favour, you have to remember that Tywin made his name by destroying house Reyne of Castamere who were distant relatives that dared to suggest that they were equals and by seizing power from his father (whose weakness turned the once great house into a laughingstock).
Essentially his entire existence was about making his house strong and then along comes this deformed child which kills his wife in childbirth and makes the family the butt of everyones jokes again (at least in private), Cersei hates Tyrion for taking her mother away (her whole personality is actually shaped by that event, she's not a ****, she just has PTSD).
Tywin sees him as a mockery of his own life but he understands the importance of blood, direct family are the only ones you can really trust. Jaime is the only member of the family who just loves him as a brother, any favour shown to Tyrion is more about using the available tools than actually wanting to reward him, no matter how well he does something he can't escape the stigma of his birth and the embarrassment it caused the family