Shut the circuit off. Leave off til fixed.
You took a chunk out of the wire, if not severed the whole wire. That means it's thinner, or out of contact entirely.
If it's thinner, that means current is squeezing through a narrow part. This will make the wire hot there. It could get hot enough to ignite a fire on the wrong side of the walls.
Of if the wire is cut entirely, or passing through the nail, it is bound to start arcing. Arcing makes a tremendous amount of heat - it will heat up much, much faster than a nicked wire, and could start a fire going in less than a minute.
Drywall is a fire-stop. That means, fires which start in between the walls are hard to detect. They can become "fully engaged" (turned into a pretty big fire) before you even detect it.
And then what? It's almost impossible to fight a fire on the wrong side of the drywall, unless you are a pro fireman who hatchets drywall every day. By the time they arrive, the fire will be so engaged that they'll have to wreck the place to save the structure at all.
How to avoid it?
Obviously, this is a common risk. Every country has an electrical code (really, although it is sometimes not enforced pre-accident) and many electrical codes provide provisions for how to resolve the conflict between wire damage and nailing things to walls. For instance some countries require metal plates to guard cables, or that wires be placed a certain depth in the wall - that creates a "safety zone" where one can nail with confidence as long as your nail is short, and you don't power through a guard plate.
It's best to learn the convention in your country, and follow it.