The Register takes a look at why people use 'um', 'er' or 'ah' when they hesitate while speaking. It also depends upon the language:
For example, speakers of Mandarin Chinese often say"zhege" which roughly translates as “this”. In English we say "um", "er", "ah", or other vocalisations for reasons that linguists are not entirely sure about. "Um", "er", and “ah” contain what linguists call "neutral vowel sounds" making them among the easiest sounds to make.
It may be that they can be said without a great deal of thought too. So that may be part of the answer. "Um", "er", and "ah" are what linguists call "fillers". "Fillers" help conversations continue smoothly.