To a squirrel, walking along a high-wire comes naturally.
Squirrels are arboreal creatures—tree dwellers—and are perfectly adapted to walking along narrow branches.
In a mature forest, squirrels can travel for miles without ever touching the ground, by walking along branches and leaping between trees.
In the city tree cover is less dense, but sometimes the wires humans put up can be a good substitute.
Where we live we often see squirrels crossing busy streets along wires, which is much safer than dodging traffic on the road.
As you can see from this picture, squirrels walk on top of the wire, they don’t need to cling to it unless they lose their balance.
Their tails help them maintain their balance. If you watch a squirrel walking along a wire you will see them swish their tail back and forth to maintain their center of gravity.
As for electric shock, most wires in residential areas are low voltage and properly insulated for the safety of humans. In some cases squirrels can get zapped, but this is relatively rare.