Attaching towel rail to drywall
Figure out what is there first
As you noted, there are wires, and possibly plumbing (though less likely) in the wall. Drilling a pilot hole is a good way to verify the thickness of the drywall (1/2&quot; is typical - but there are sometimes 2 layers = 1&quot;). The other thing you might run into, which is a good thing to find is a stud. In a recent building, the studs may turn out to be metal rather than traditional wood. Either way, studs are great for mounting towel bars, and anything else. The one catch is that a pilot hole over a metal stud may not be immediately distinguishable from a pilot hole over a metal plate that is protecting wiring.
In a Stud
If either end of the towel bar lines up with a stud, then use long screws - typically around 1&quot; longer than drywall + mounting hardware - to go directly into the stud. No anchors needed!
For wood studs, use cabinet screws. Do not use drywall screws - they are designed to attach the drywall to the studs and not for attaching over things on top of the drywall - they are handy in a pinch for all kinds of temporary and/or low-strength applications, but not for long-lasting heavy-duty applications.
For metal studs, drill larger holes and use toggle bolts. While you can use toggle bolts as anchors in drywall without studs, with metal studs you don't have to worry about the drywall crumbling under pressure - done right they will last forever even if people use the towel bar as a grab bar.
Into a Hollow Wall
Unfortunately, most of the time at least one end of the towel bar will end up over a hollow wall cavity. There are a variety of anchors used for this - most people swear by some and swear at others. There are plenty of plastic expanding anchors, as well as toggle bolts and other gadgets. Check the rating and get stronger than you think you need. A towel bar, unlike a mirror or many other things, will be used at least occasionally as a grab bar due to the nature of bathrooms - wet feet, slippery floors, etc.
All that being said, good quality anchors are fine for a regular towel bar if you can't get into the studs.
A real grab bar?
If you actually need a true grab bar - and there are plenty of towel bars designed to do double-duty as a grab bar - then you really want to get into studs on both ends or add extra backing (either cut into the wall, add wood, patch over and screw into it like studs; or a painted/stained wood piece placed over the drywall, screwed into studs and towel bar on top of that). But based on the picture, it looks like the towel bar will be next to the sink and not next to the tub/shower, so an &quot;ordinary&quot; installation should be sufficient.