Coming up with character names is tricky. The name chosen needs to fit the character's personality and their physical description. Contemporary novels are slightly easier than historical novels in considering names, but you still need to have that right fit. In The Gangster's Daughter, which was an idea in my mind for many years, I knew immediately that my main character names were going to be Regan and Cameron. There was no doubt about it. Everyone else either did not exist yet, and I had to find the right name, or the name changed. Regan's father, Gavriel, was originally going to be Bruce.
I do a bit of research on nationality when choosing a name, but it doesn't always work. Gavriel is an Italian name. I have some books that I use that break down names by nationality, and I use these but I also use the internet. The internet is a wondrous place to find information. I discovered a website that makes up character names from given criteria. Criteria such as gender, character type, nationality and birth year. I don't always find what I'm looking for there, but it's interesting what it generates. There've been times when I have heard a name in passing and thought 'that is a cool name'.
Historical is harder to come up with names. In The Duke's Daughter, I changed the heroine's name at least five times. I finally settled on Evie, and it fit her perfectly. This is equally true with the hero Xander. His name changed at least five times, as well. In fact, almost all the characters in The Duke's Daughter have had a name change. This is also a story that has been on my mind for many years.
Choosing names for historical characters requires consideration of era, personality, and appearance, while avoiding absurdity. I've come across some names of era's that I wouldn't dare put in a novel, and there are some names that are unique but don't fit the character. Historical names are everywhere between baffling and classic. I take a long time pouring through books and the internet, using every resource I can to find the name that fits my character perfectly.
Surnames are a different story. Going way back, surnames weren't used until after the Norman conquest. They identified an individual's trade, birthplace, physical features, and sometimes father's name. Once surnames came into play, you now have to put two names together that make sense and fit the character. Think of famous character's such as Harry Potter (yes, you caught me). Reading the books, or watching the movies, can you think of this character with any other name? Probably not. It fits his character just as Hagrid, Hermione and Ron.
The main thing I have to remember when I'm trying to come up with the perfect character name is not to let it hang me up. I noted dozens of possibilities, then move on. For my fourth novel (not yet named), I found my two main character names right away, but I have several other characters I have to come up with, so I noted several more. I also need dog names and breeds for this one, so this is going to be a fun one. It might change later, it might not. Typically, I have character names set before writing, so I don't miss any changes.