If you plan on using your shelving primarily to store or display a large number of books, you'll need to take great care in mounting the shelf to the wall. Books will put a lot of strain on any anchoring device you might use. While securing the anchoring device to a wall stud is preferred, you may not have the luxury. In that case, a wall anchor made for drywall and rated to hold the weight of your books will work fine.
Determine where you want your bookshelves to go. With a pencil, lightly mark the location on the wall.
Locate the studs behind the drywall with a stud finder. The number of studs you'll need to locate depends on the width of your bookshelf. Studs are placed every 16 inches, so you can locate the other studs with a tape measure, verifying their locations with a stud finder. If you must drill into drywall only and not studs, you'll need to use anchor bolts rated for the weight of the books you plan to place on the shelves.
Ensure that the marks you made are level. Use a carpenter's level to do so.
Place L brackets on the spots where studs are marked, or on the spots where you'll insert anchor bolts. Use a pencil to mark where you'll drill holes to secure the L brackets to the wall.
Compare the diameter of the screws your purchased for use with your L brackets, selecting a bit that's slightly smaller than the screw. Drill pilot holes into the spots you marked on the wall in Step 4. If you're using anchor bolts, then select a drill bit that's the same diameter as the anchor bolt, then drill a hole for the anchor bolt.
Insert a Phillips head screwdriver bit into the drill and secure the L bracket to the studs and wall. If using anchor bolts, tap the anchor bolt into the hole you made. Then use a Phillips head screwdriver to tighten the anchor bolt so it holds the L bracket securely agains the wall. Repeat this step for all the L brackets you'll need to support the width of the shelf.
Place the bookshelf on the L brackets. Have a helper hold it while you mark where to drill pilot holes on the underside of the shelf.
Compare the diameter of the 1/2 inch wood screws with your drill bits, selecting a bit that's slightly smaller than the screw.
Drill pilot holes into the the shelf, ensuring that you do not drill all the way through the shelf. To help prevent this, use masking tape to mark the drill bit at the maximum depth you should drill.
Place the bookshelf on the L brackets. Have a helper hold it in place as you use a screwdriver to secure the shelf to the L brackets with the wood screws.