Make a pencil mark on the wall at the height where you want to locate the shelf. Place a level on the wall at that point and draw a light pencil line along the level
Place a shelf bracket on the wall, with the top edge 1 inch below the line. Mark the location of the bracket's mounting screw holes on the wall. Position the second shelf bracket 24 inches from the first bracket, position it on the line and mark the screw holes as before. Simple metal shelf brackets can be purchased at home improvement stores for a few dollars each.
Drill a hole at each of the marked locations. Insert a hollow wall anchor in each of the holes. Place the brackets on the wall and line up the holes with the anchors. Insert screws and tighten them.
For shelves that need to hold heavier items, run a stud finder along the line and mark the location of the studs in the wall. Place the brackets on the wall at the stud locations and mark the mounting hole locations onto the wall. Drill pilot holes through the wall and into the studs with a 1/8-inch drill bit. Line up the brackets with the holes and insert wood screws. Tighten the wood screws.
Cut a board to 36 inches in length. Place it on the brackets and attach it from below with screws fed through the holes in the shelf brackets. Simple pine boards can be purchased for about $5 as of 2011.