What a gong show! Here's what happens:
Hertha Berlin player shoots. Nürnberg guy handballs on the line. Ramos (Berlin) puts it in the net but the goal is disallowed because he was offside when the original shot was taken.
Therefore: no goal, but should be penalty and red card for Petrak (Nürnberg) for DOGSO by hand.
Instead the referee gives the red card, then disallows the goal for offside, then takes back the red card, then restarts play with a Nürnberg free-kick for offside. It kinda looks like he books a Berlin player for protesting too, but not a hundred percent about that. The reason for not giving the penalty is presumably because the assistant referee thinks Ramos was impeding the goalkeeper and/or defender while offside.
To add insult to injury, Nürnberg scored again in added time to win 3-1.
What would I do? Well, there are two answers: with the benefit of hindsight I'd probably blow my whistle, go talk to the assistant, ascertain that the goal couldn't stand because of offside, but then award a penalty and give the Nürnberg player a red card, having told my assistant that I didn't think Ramos's position affected Petrak's handball. Then I'd explain it quickly to the Berlin captain so that he understood why the goal couldn't stand and get on with it.
Good refereeing, huh?
The second answer - what I'd actually do if I was there in real time, with no replay to help me out - is impossible to know. Hell, I may even do worse than this well-paid, highly experienced top level professional referee, wink wink. He makes an honest decision, based on what his assistant has told him, and you can't blame him for that. The two mistakes he does make, I think, are: a) not checking with his assistant before flashing the red card; and b) not explaining to Hertha Berlin - the captain or whoever - that the goal has been disallowed and why. There's a lot of confusion there, with players celebrating even as he awards the free-kick for offside. "He was offside. He was interfering with the defender. No goal." It wouldn't take long and I doubt they would have liked it - there's no way in my mind that Ramos did interfere with the handballing defender - but I think in such a situation they deserved an explanation.