This page of the guide to TES V: Skyrim describes getting through the keep with Hadvar as part of the first main quest, called Unbound. The following walkthrough presents only the situation when you decided to work with Hadvar, not with Ralof. While completing the quest, you can also deal with additional objectives.
New main objective: Escape Helgen
New main objective: Find some equipment
Start off by approaching Hadvar, so that he can free you from the bindings. Follow his hint and search the Warden's Chest (screen above). Inside, you will find inter alia a sword and hero gear. Of course you should equip them at once in the inventory. While you're at it, I'd also suggest taking a look around the room as you can find some other precious items here.
Follow the south corridor and afterwards turn west. Wait for Hadvar to unlock the passage to the oval room, inside of which you will have to fight two Stormcloak soldiers (screen above). Use the fact that they will mainly focus on Hadvar to your advantage. Also don't forget about leading out heavy attack and blocking theirs. After the fight, examine the enemies' corpses and remember to do it every time in the future.
Keep following Hadvar, following the western exit and afterwards going down the stairs onto the lower level. Ignore the tunnel that will collapse before your eyes and enter the nearby room. Here you will have to fight Stormcloak soldiers once again (screen above), without any particular difficulties.
New optional objective: Search the barrel for potions
In accordance with the received hint, it would be good to examine the barrel marked by the game (screen above), hiding a minor health potion, minor stamina potion and minor magic potion. The same goes for the room, as many valuable items can be found hidden inside it.
After exploring the room, approach Hadvar to continue going through the Keep. Soon you should reach the dungeons and there you should help the Torturer in getting rid of a group of Stormcloak soldiers (screen above). Afterwards hear out a short conversation and note that you received a dozen of lockpicks.
New optional objective: Attempt to pick the lock to the cage
I'd suggest devoting some time to complete the optional objective connected with opening the cage, even if you don't want to play as a rogue in the further part of the game. Approach the marked cage and interact with the door. Familiarize yourself with the instructions and approach the rather easy mini-game (screen above). You have to turn the lockpick each time and afterwards check if its position lets you perform a full turn of the lock. If you adjust it correctly, the lock will get opened and if you keep on trying to turn the lock in an incorrect position for too long, you will break the lockpick. Luckily, even if it happens that you use up all the lockpicks received from Hadvar, you can always find more inside the room you're in. After opening the cage, firstly collect all the items that once belong to the former mage. Apart from that pick up the items lying around him, especially the Spell Tome: Spark. Take a look around the room to find some items useful for the warrior. Open up the other chests and pick up The Book of the Dragonborn as well.
Now head to the corridor going west and after a few moments turn south and use the stairs. Head towards the big hole in the wall. You will come across some more Stormcloak soldiers after reaching a bigger cave. Be careful, as there will be a rather big group of them to eliminate. Additionally archers will attack you from the southern part of the room (screen above). Try to avoid their attacks and eliminate them in direct combat.
Move on to the west. Wait for Hadvar to lower the drawbridge and keep going forward, ignoring the fact that another passage collapsed behind you. After reaching a bigger cave head south and afterwards turn west. Soon you should reach a spot where a group of Frostbite Spiders (screen above) will attack you. Keep moving throughout the whole battle to avoid their poison. Also remember to focus on attacking only one of them at a time. Afterwards don't forget to examine their bodies and collect the precious (and light) Frostbite Venom.
Now head east, eventually reaching a big cave. Stop after Hadvar notices a bear. Listen out what he has to say about the possible options. Note that you have received a long bow with twelve Iron Arrows. If you don't intend to attack the bear, crouch and head south-east (screen above). If only you don't approach the beast too close, you shouldn't get attacked.
If you want to get rid of the bear, you will have a wider choice. The most obvious solution is using the bow that you received from Hadvar (screen above). You could also take care of him in different ways, for example in direct combat or using magic. Don't forget to check its body afterwards.
Regardless of whether you avoided the bear or fought him, you should soon reach an exit to the surface (screen above). Wait for the game to move to a new location and listen out to what Hadvar has to say. He will suggest that you should head to the nearby town of Riverwood to meet with his uncle, Alvor.
Main quest unlocked: Before the Storm