When you climb on the book shelves, hit the flying books two times and they will fall. You can now jump onto the next shelf. When you make it to the book, it does not matter if you die -- you will be put back up onto the ledge.
In order to get past the Prefects, shoot Expelleramus at their Locomotomortis spell just as when they are going to hit you. Follow the map above to get to the picture. you must hit each of the prefects with the cheat. Once you get to the picture, go towards the right and climb the ladder. Then, slide against the wall and get to the next ladder. Do this repeatedly until you reach a large iron door. In both of these rooms, watch out for books. Then, when you enter the room, go to the left, find a perch, and call Hedwig. You must then find the owl treats on the other side of the room in the chest. Feed Hedwig and he will lower a ladder by a door covered in Ectoplasma near the chest. Note: The ladder is to the left; it is hidden very well on a bookcase. Also, remember this place, as you will need to go back to it. Climb the ladder and jump to the platform above the Ectoplasma-covered door. Then, jump again and then once more. You should be at a place near a balcony. Cut the red ribbon with the Defindo spell. Then, jump onto it. Go to the other side and Defindo again on this ribbon. Jump onto the bookcase and use the Lumos spell to see where you are going. Note: Put away the Lumos spell before you jump. Then, jump again and then once more to reach the book. A "mysterious" door will open and you must go through it. Save the game before entering. Watch out for ghosts and books in this room. Then, you must defeat the bookcase. Hit the bookcase with Flippendo frequently, until it rumbles and shakes. Run away behind another bookshelf and wait for two groups of swishes or two groups of books to pass, then repeat the process until it dies. Then, push the box to the bookcase nearest to the front in the center. Hop onto it and climb onto the bookshelf. Hit the books two times and jump over to the next shelf. Keep doing this until you reach the other book. This book allows you to defeat the Ectoplasma. Leave the room and go to the door that you noted. Use the new spell on it and go through the door. Then, go to the other side of the room and open the door. You will see a strange door and green walls with ghosts in them. You must use the Ectoplasma spell and release the ghosts. Do not let them hit you. After you use the spell, go into the room that it opens. Find the button and push it. Do this to the other walls. Two of the times, Goyle and another kid will battle you (not Draco though). Then, when all the bars over the door open, go through the door. This room will look strange. You must push the boxes to the beginning of the room, where there is an open spot in the ledge. Go up onto the ledge and you will see a curtain. Cut it down and use the Skurge (Ectoplasma) spell on the lever. Do this to the other side of the room. After this is done, the door will open. Go through it and use Lumos to light up the room. You will now be where you are after you push the secret door.
Hermione asks you to get Hogwarts: A History from the restricted section of the library. To find it, you have to go the library and past the Prefects to the other side of the room. If you go up through the left side of the room, you will see a dark brown door in an alcove. Do not go in there. Go to your right and you will see a light brown door. Go in there and get past the Prefects to the portrait.