About 60 years ago there was an invention that has a huge impact on electrical safety even today. It is called Ground Fault Circuit Interrupter (GFCI) receptacles, and they might have saved your life already.
GFCI receptacles are designed to cut power when an unbalanced current is detected. Since this could be an indication that your body has closed a circuit and current is going through you, the quick cutoff is the only thing that could save you. This is why GFCI receptacles are installed wherever there is a water source.
Since water and metal pipes are excellent conductors, using electricity in a bathroom is very dangerous.
To make sure that your GFCI receptacles work, you should test them regularly with a simple electrical device. If power is cut off to it when you push the “Test” button on the receptacle, then you know that it works. Pushing the “Reset” button back in should restore power.