In The Elder Scrolls V: Skyrim for the PC, PS3, and Xbox 360, if you mess up and strike a guard, they will indeed try to kill you, so how do you get them to stop attacking you?
All you need to do is sheath your weapon (or put away your magic hands, etc) and they should stop attacking you. At that point, they should open a dialogue with you and explain that you’ve committed a crime, and to pay up or go to jail.