(Click the character infographic to download.)
Doctor James Mortimer starts out the novel as a figment of Watson's imagination. By looking at Doctor Mortimer's forgotten walking stick, Watson guesses that he is a "successful elderly medical man, well-esteemed" (1.6), a "country practitioner who does a great deal of his visiting on foot" (1.8), and that he got the walking stick as a present from "the local hunt to whose members he has possibly given some surgical assistance" (1.12).
Holmes, of course, laughs at him, and points out all of the reasons that we should be able to see Doctor Mortimer for what he really is from his walking stick: "a young fellow under thirty, amiable, unambitious, absent-minded, and the possessor of a favorite dog" (1.29). When Doctor Mortimer shows up at their door with a curly-haired spaniel, he only confirms Holmes' assessment of his character.
As we've mentioned in our "Character Analysis" of Sherlock Holmes, this early scene of deduction goes to show Holmes' brilliance and Watson's, well, less-than-brilliance (though, as we keep saying, he's plenty smart!). It also shows a common mode of characterization in this novel: Holmes' assessment of people is always right. The whole point of Holmes' detecting technique is that he can read people like books.
So Doctor Mortimer comes into the story mainly as a handy plot device to show how brilliant Holmes is. We know that he has this unusual habit of investigating the shapes of skulls to see what they can tell him about different people (and different races, which is the ugly side of his "scientific" practice). But beyond this weird detail of Doctor Mortimer's interest in phrenology and physical anthropology, he's not much of a fully rounded character.
Doctor Mortimer does provide us with lots of important information about the case. He's the one who tells Holmes about the old family legend of the Hound of the Baskervilles, and he's the one who brings Sir Henry to meet Holmes before they go down to Baskerville Hall together. Doctor Mortimer also happens to be riding by in his cart just as Watson needs to ask someone about a local woman with the initials "L.L." We also see a flash of his intelligence when he figures out from examining the ashes of the late Sir Charles' cigar that Sir Charles waited for Laura Lyons for about five or ten minutes.
Doctor Mortimer happily fills Watson in on the background of Laura Lyons, who turns out to be key to the case against Stapleton. But when Doctor Mortimer isn't required to give us plot exposition or some comic relief about skulls, he disappears from the narrative.
(There's a very minor linguistic joke going on here, by the way: "Mors" is the personification of Death in Roman mythology, and many Latin medical terms to do with death (rigor mortis, livor mortis, and so on) all use the sound "mort." Doctor Mortimer's name emphasizes his association with dead things—in his case, skulls. Hopefully not his patients.)