Tall bookshelves often are heavy. By securing the bookcase to the wall, no small children can pull the shelves on top of themselves. It also secures the heavy item in case of an earthquake. Two simple "L" brackets can hold the bookcase to the wall studs, keeping it firmly in place.
Use a stud finder to locate two studs that run behind the bookcase. Mark the location of the studs with a pencil, just above the top of the bookshelf.
Place the two "L" brackets against the wall, with one leg on top of the bookshelf and the other leg against the stud where you marked it.
Use an electric drill to drive two wood screws through the mounting holes in the leg of the bracket that is touching the top of the bookcase. Each bracket has two holes in the leg. Put one screw through each hole, into the top of the shelf.
Use an electric drill to drill two 3-inch lag screws through the two mounting holes in the leg of the bracket that is up against the wall. Drive the screws through the studs until the screw head is flush with the wall. Do this to both brackets.
Select a wood screw that is long enough to go into the top of the bookcase but is not long enough to come out through the wood.