When you have a power source it needs two wires to make a current flow: a wire "out" and a wire "back". You're only part of the circuit if you're connected to both sides.
When the two wires are not connected to anything, there is infinite resistance between them.
If you grab one side then there's no path through you to the other side so no current flows: the resistance between the two wires is still infinite.
Due to Ohm's law, (V=IR), if the current through you is zero then the voltage across you is also zero. The hand touching the wire is at the same voltage as the rest of your body.
So you "float up" to whatever voltage the wire you are touching is at.
If you complete the circuit then current starts to flow. The shock you receive is related to the current that flows through you. However, even tiny currents cause a big shock because humans are quite sensitive to currents in the micro or milliamps range as that's more than our nervous system uses to move our muscles.