A filler word or hesitation noise.

These are used to indicate 'I'm not done talking yet' when used in a sentence. It informs the listener that now is not the time they should jump in with their views on the subject -- they should wait until you finish this thought.

As most speeches, monologues, and dialogs performed in front of an audience are pre-rehearsed, we tend to see ums, ahs, and ers as failings in speakers.

They are also used (Um especially, in America) to let the other person know that you don't quite understand what they're saying. In this case it would be used after they have finished their sentence or thought. With luck a well placed 'um' will goad them into elaborating.