But were any other characters, for instance the Mad Hatter, inspired by real life people, and what evidence is there for this in Alice in Wonderland and Through the Looking Glass, or were they made up by Carroll?
Martin Gardner's The Annotated Alice contains some excellent literary analysis of both Alice in Wonderland and Through the Looking-Glass, including a lot of surrounding information about Carroll in real life which helps us to analyse his books. I shall be quoting heavily from this below.
Many of the group of wet animals in Chapter 3 of Alice in Wonderland - "a Duck and a Dodo, a Lory and an Eaglet, and several other curious creatures" - are based upon real people. From The Annotated Alice (emphasis mine)
Carroll's Dodo was intended as a caricature of himself—his stammer is said to have made him pronounce his name "Dodo-Dodgson." The Duck is the Reverend Robinson Duckworth, who often accompanied Carroll on boating expeditions with the Liddell sisters. The Lory, an Australian parrot, is Lorina, who was the eldest of the sisters (this explains why, in the second paragraph of the next chapter, she says to Alice, "I'm older than you, and must know better"). Edith Liddell is the Eaglet.
It is amusing to note that when his biography entered the Encyclopaedia Britannica it was inserted just before the entry on the Dodo. The individuals in this "queer-looking party" represent the participants in an episode entered in Carroll's diary on June 17, 1862. Carroll took his sisters, Fanny and Elizabeth, and his Aunt Lucy Lutwidge (the "other curious creatures"?) on a boating expedition, along with the Reverend Duckworth and the three Liddell girls.
June 17 (Tu). Expedition to Nuneham. Duckworth (of Trinity) and Ina, Alice and Edith came with us. We set out about 12.30 and got to Nuneham about 2: dined there, then walked in the park and set off for home about 4.30. About a mile above Nuneham heavy rain came on, and after bearing it a short time I settled that we had better leave the boat and walk: three miles of this drenched us all pretty well. I went on first with the children, as they could walk much faster than Elizabeth, and took them to the only house I knew in Sandford, Mrs. Broughton's, where Ranken lodges. I left them with her to get their clothes dried, and went off to find a vehicle, but none was to be had there, so on the others arriving, Duckworth and I walked on to Iffley, whence we sent them a fly.
In the original manuscript, Alice's Adventures Under Ground, a number of details appear relating to this experience that Carroll later deleted because he thought they would have little interest to anyone outside the circle of individuals involved. When the facsimile edition of the manuscript was published in 1886, Duckworth received a copy inscribed, "The Duck from the Dodo."
There have been various theories about whom the Mad Hatter might be based on. From The Annotated Alice (emphasis mine):
There is good reason to believe that Tenniel adopted a suggestion of Carroll's that he draw the Hatter to resemble one Theophilus Carter, a furniture dealer near Oxford (and no grounds whatever for the widespread belief at the time that the Hatter was a burlesque of Prime Minister Gladstone). Carter was known in the area as the Mad Hatter, partly because he always wore a top hat and partly because of his eccentric ideas. His invention of an "alarm clock bed" that woke the sleeper by tossing him out on the floor (it was exhibited at the Crystal Palace in 1851) may help explain why Carroll's Hatter is so concerned with time as well as with arousing a sleepy dormouse. One notes also that items of furniture—table, armchair, writing desk—are prominent in this episode.
[...] "It is impossible to describe Bertrand Russell," writes Norbert Wiener in Chapter 14 of his autobiography Ex-Prodigy, "except by saying that he looks like the Mad Hatter . . . the caricature of Tenniel almost argues an anticipation on the part of the artist." Wiener goes on to point out the likenesses of philosophers J. M. E. McTaggart and G. E. Moore, two of Russell's fellow dons at Cambridge, to the Dormouse and March Hare respectively. The three men were known in the community as the Mad Tea Party of Trinity.
Ellis Hillman, writing on "Who Was the Mad Hatter?" in Jabberwocky (Winter 1973), provides a new candidate: Samuel Ogden, a Manchester hatter known as "Mad Sam," who in 1814 designed a special hat for the czar of Russia when he visited London.
Hillman also conjectures that "Mad Hatter," if the H is dropped, sounds like "Mad Adder." This, he writes, could be taken as describing a mathematician, such as Carroll himself, or perhaps Charles Babbage, a Cambridge mathematician widely regarded as slightly mad in his efforts to build a complicated mechanical calculating machine.
However, I don't think any of these theories sound especially convincing. The first one, in particular, has been refuted by Stuart Dodgson Collingwood in his book The Life And Letters of Lewis Carroll, in which he claims that there is no evidence Carroll ever invited Tenniel to Oxford for any reason.
This may not really count since it's a story within a story, but the Dormouse's "three little girls" are again based on the Liddell sisters. From the original text (Chapter VII):
"Once upon a time there were three little sisters," the Dormouse began in a great hurry; "and their names were Elsie, Lacie, and Tillie;11 and they lived at the bottom of a well—"
From The Annotated Alice (emphasis mine):
The three little sisters are the three Liddell sisters. Elsie is L.C. (Lorina Charlotte), Tillie refers to Edith's family nickname Matilda, and Lacie is an anagram of Alice.
The Drawling-Master referred to by the Mock Turtle is based on Alice Liddell's drawing-master John Ruskin. From the original text (Chapter IX):
"Well, there was Mystery," the Mock Turtle replied, counting off the subjects on his flappers,—"Mystery, ancient and modern, with Seaography: then Drawling—the Drawling-master was an old conger-eel, that used to come once a week: he taught us Drawling, Stretching, and Fainting in Coils."
From The Annotated Alice (emphasis mine):
The "Drawling-master" who came once a week to teach "Drawling, Stretching, and Fainting in Coils" is a reference to none other than the art critic John Ruskin. Ruskin came once a week to the Liddell home to teach drawing, sketching, and painting in oils to the children.