Twisted Rune Hideout Overview - Baldur's Gate 2
When you first teleport into this dungeon you'll have plenty of time to buff up which you should absolutely do (along with saving your game). If you're unfamiliar with how Baldur's Gate works and what buffs you should be using or if you want some strategies for dealing with tough fights like these I recommend you check out my Baldur's Gate 2 Beginner's Guide.
After you defeat all of the enemies you will need to loot the Beholder Eye from Vaxall and place it in to the cauldron on the eastern end of the map. This will allow you to interact with the lever machine in the north which teleports you outside the dungeon.
"The Fight" Room: Entering this room will trigger dialogue with Shangalar which leads to the fight starting. Make sure you're fully buffed up and ready before engaging. When all of the enemies are dead be sure to loot Staff of the Magi from Layene.