This is something that you have minimal control over. Most electrical runs going horizontally are about 2 feet off the floor or very close to the ceiling. There are lots of reasons for this but one of the obvious ones is it limits the areas of concerns when drilling.
Also for horizontal runs there should be a little slack where an anchor would just push the wire out of the way. For vertical runs these are stapled to studs on one side or the other. So just hit the middle of the stud.
Really two things that help me investigate walls if I am worried are monkey hooks and my magnetic stud finder. With the monkey hooks you can prick a wall for a good two inches plus while causing almost no damage. You can easily "feel" something if you hit plumbing, electrical, insulation, whatever.
With the magnetic stud finder you can use the drywall screws to find your on center of your framing members. With a spare yardstick or 2x4 and a couple of screw points you can find the center of a stud the drywall is attached to. From there you can assume that there is a 1-2 inch "don't screw" zone on each side. As usually the only issues you will have with anchors is screwing into something tightly stapled. Even screwing into a wire ran through a bored hole would be hard because unless the hole is really small or there are a lot of wires the screw will push the wire out of the way.
Note: For a heavy bookcase I would rely on an L bracket using toggle anchors - pictured below - in the wall. My reasoning for toggle anchors is that other anchors could effectively strip or lose binding but in effect stay in place because the shelf hasn't moved enough. You don't want to find out that your anchor has stripped when you climb up to get something off a top shelf. The toggle anchor won't give you a snug connection but you don't need it to be hardcore snug, you need it to work. (also note that the toggle anchors usually don't have a sharp tip, therefore making it ultra hard to damage wiring)
+++ This answer was meant for anyone dealing with wood/metal framed walls. This would include most people in USA, Canada, Australia, New Zealand, parts of Mexico, parts of Asia, most dividers in large apartment buildings. The safe zones for drilling are usually the same no matter the country but the depth of the wiring and how it is secured is not. As for safety I would still offer that a prick test is better than any voltage meter I have ever used. If I was afraid of the prick going through the electrical conduit after going through a cinder block I would simply cover the tip (rubber, plastic, chewing gum).