How is "erm" pronounced in the UK, and why is it spelled that way?

It's spelled that way because the English of many parts of Britain is non-rhotic. The sound you make when hesitating in speech is traditionally written 'er', but pronounced much like the American 'uh', and 'erm' is just a variant. See https://separatedbyacommonlanguage.blogspot.co.uk/2008/05/uh-er-um-erm.html


From my experience with British English, I will try to answer your questions to the best of my ability, in order:

  1. It is pronounced /ɜːm/, as opposed to the American English ⟨um⟩, said as /ʌm/.
  2. This I could not be sure of. At the very least, going from Google's Ngram Viewer, there seems to be a particular spark in its use from the late 1730's to the 1750's and some generally steady use after that, but I do not know whether or not that correlates with when it came to be considered standard and accepted.
  3. I believe that it is based on their typical use of ⟨r⟩, when placed after vowels, as it is typically used to lengthen them (e. g. pronouncing the letter "R" as /ɑː/ or "turn" as /tɜːn /) or else to add the unstressed "uh" sound /ə/ ("hair" as /heə/ and "father" as /ˈfɑðə/), and thus, as they would say /ɜːm/, the vowel there being a long /ɜ/, it would make sense for it to be spelled ⟨erm⟩ if it is to remain consistent with other words with similar phonetic structure.
  4. I sincerely doubt that it was ever used as a contraction of the two, it merely seems to be the sound used by speakers of British English to convey ideas that speakers of American English would use "um" for.

As for your final question at the bottom, that would be because it is pronounced differently, as stated above.