There's an interesting book called The Return of Martin Guerre that touches on this. It's about a guy (Martin Guerre) in 15th century France who leaves his wife, family, and home town to join the army. Out of nowhere, he comes back several years later. Over the course of about four years, his family realizes that it isn't actually Martin Guerre, but an impostor. They had a trial, and the impostor almost got away with the act- but the real Martin Guerre showed up at the last minute and proved who he was.
In terms of how the impostor did it, he had several things going for him. First, he looked like Martin Guerre, and several people mistook him for Guerre when he neared the town. Second, he was clever enough to glean important information from the various townspeople. It is possible that he also met Martin before entering the town, and it has been suggested that Martin's wife worked with the impostor, but neither of these can be proven.
What ultimately tipped off the family was a cultural mistake. Guerre's family were Basques that had moved to France within Martin's lifetime, so they still practiced Basque customs. One of these involved never selling your inherited land, which the impostor attempted to do. This caused a feud between the impostor and Martin's uncle, which eventually led to the trial. Other things happened as well- the town's cobbler noticed that the impostor's feet were smaller than Martin's, for instance.
I'm not sure how common this was, but we can see a rough idea of how identity was confirmed. Visual recognition seems like it was the primary means of identification. Failing this, the only way to tell was through a person's local or cultural knowledge. This is how the impostor was able to deceive the town, and ultimately how the real Martin Guerre proved his identity.
Perkin Warbeck is another interesting case of an imposter. In 1490, he arrived in England claiming to be Richard of Shrewsbury, Duke of York: one of the "princes in the tower". For those who don't know, the princes were Edward IV's young sons who were imprisoned in the tower in 1483 when Richard III took the throne, and who ultimately disappeared. Although they were most likely murdered (a wooden box with two small skeletons was discovered under a staircase centuries later), rumors were rampant about their fate. For years after Richard's coup, there were were fanciful reports that one or both princes had someone escaped to be spirited abroad.
Enter Warbeck. He claimed to have been sheltered abroad, was received as the Prince by multiple nobles as well as several courts of Europe. The willingness of the nobles to accept his claims rests in part on the fact that they were dissatisfied with Henry VII's reign and saw the return of "the Duke of York" as an opportunity to further destabilize him.
What's particularly interesting about Warbeck's case is the fact that several of the real Duke's relatives - his aunt Margaret of York, his sister Elizabeth of York (Henry's wife and queen) - appeared to accept his claims as true, at least for a time. Whether they truly believed or saw opportunities for political gain is difficult to say.
After Warbeck was used as a figurehead for a full scale invasion of England (with the support of James IV of Scotland), he was imprisoned. Under interrogation, he revealed himself as a Dutchman whose similar appearance to members of the House of York led him to be exploited by those seeking to overthrow Henry's regime. His exact true biography as still somewhat in question since much of his "confession" was obtained under duress.
hi! fyi, you'll find some interesting info on your second question - with I suppose implied answers for your first - in the FAQ
The section is organized roughly chronologically with the middle ages in, well, the middle, although answers for that period could be sprinkled around anywhere. In particular, check out these
/u/medieval_pants in How were people identified before driver's licenses and photographic ID cards?
/u/whoosier in What kind of identifications did people in the middle ages use? Were they ever needed?
/u/aethelric in How did medieval outlaws stay outlawed (i.e. Robinhood)?
All of these posts have been long archived, so if you have follow-up questions for any of the users, just ask here & mention their usernames to notify them
A rather dramatic case of identity theft was recorded by John of Ephesus in the late sixth century. The Roman and Persian empires had been fighting a war since 572, but in 579 the Persian ruler Khusro I died, leaving the throne to his son, Hormizd. Allegedly, the Persians had a tradition of killing of the new ruler's brothers, but one brother was said to have been sent away by his father much earlier. A young man therefore took his chance and pretended to be this missing son, telling the Roman commander in Roman Armenia that with Roman support, he would subdue Persia and bring Hormizd to Constantinople. The Romans were somehow convinced by this imposter and sent him off to the capital to the see the emperor, Tiberius II Constantine. Unfortunately however, there were a few Persian ambassadors in the city and after further questioning with their help, it was determined that the man was just an imposter. There is a happy ending though, as Tiberius did not punish him overly harshly:
The king, therefore, gave orders that he should have a place appointed for him to remain in, but did not punish him as his falsehood deserved; he even assigned him a sum for his maintenance, and that of those who were with him, but he would not admit him into his presence. It is said that the expenses incurred in his behalf amounted to more than three talents. Finally, he became a Christian.
This is an interesting account, because Tiberius was very happy to back pretenders in Francia and Visigothic Spain at the same time, so presumably he was angling for a chance to destabilise Persia in the same way as well. These hopes were realised under his successor, Maurice, as the Persian ruler Khusro II was overthrown by one of his generals and fled to the Romans - Maurice backed him and with Roman help Khusro was restored to his throne, in return making massive concessions to the Romans and finally ending the war between the two empires.
There is however another twist in the tale, as when Maurice was overthrown by the usurper Phocas in 602, rumours spread that his eldest son, Theodosius, survived the purge, mostly because unlike other members of his family, his head was not displayed in public. Khusro somehow got a hold of a man he proclaimed to be Theodosius and kept him around as his armies marched against the empire, ostensibly to avenge his benefactor Maurice. This was very useful for Khusro, as by invoking the old emperor's memory, a few places actually surrendered rather than continue to fight for the usurper in Constantinople. Eventually this man disappeared from history after c.610, perhaps because yet another usurper, Heraclius, had seized the Roman throne and so the value of a possible alternative decreased. Roman sources afterwards simply said that Theodosius was murdered alongside his family and that rumours to the contrary were all false, especially the person produced by Khusro, but I can't help but wonder if this Theodosius really was the crown prince. A poem from the time of Phocas talks about Theodosius as though he was still alive and that it was a fact known by the emperor. This is largely unsubstantiated, but perhaps when the Heraclian dynasty was firmly in power, they rewrote history in order to transform a legitimate imperial prince into a Persian imposter, just as they had rewritten Phocas into a brutal tyrant who deserved to be overthrown.
People were able to act as imposters at this point because without personal knowledge of a specific person, there is very little someone can do to identify them as false. Only Persian ambassadors in Constantinople who had personally known the Persian royal family were able to question properly the anonymous Persian 'prince', whilst in the case of Theodosius, his primary backers, Khusro II and a rebel Roman general named Narses, probably had never met him before the war - perhaps they did have some people in their entourage who had served in the imperial court, but this is not recorded in the sources. As for the townsfolk who were told that their besiegers included their 'legitimate' emperor, well, they were in an even less likely position to know the truth. Though these men were all public figures, it is impossible for anyone to confirm anything, which allowed people to proclaim themselves as someone else if they had the right preparation. Indeed, as I have suggested, it is even possible that the real Theodosius was transformed into an imposter by the sources, which surely demonstrates the flexibility of public identity in this period.