It can vary a lot from country to country. In France for instance, even if you get married, the name you were born with will always be your "real" name on any paperwork, however if you are married you are allowed to have a "name of use" (always shown after your "real" name) that is either your husband's name if you're a woman, or for either gender, both names, hyphenated, in either order. A husband cannot take his wife's name on its own.
Either way, you'll always be known officially as the name you were born with. You also cannot change it for reasons other than getting married, or to something other that your spouse's birth name or a combination of yours and theirs.
As far as I understand though, in the US you can generally change your name to whatever you want whenever you want (including first and middle names, which you're only allowed to change if you're trans in France).