Haven't really nailed it myself. The basis on the reasoning is this: pronouns are different. Germans feel it sound better when pronouns precede nouns and don't end the sentence. Probably because pronouns are such popular an compact words that easily roll of tongue.
For example, if it is "I'm writhing a letter to him", "him" in German will precede the letter. If "I'm writing it to my mother", then "it" wil precede. Curiously, "I'm writing it to him" will have "Ich schreibe es dir", while for the nouns it will be the other way round: "Ich screibe meiner Mutter einen Brief".
The thing is, pronouns used as objects also seem to come before the adverbs in the sentence.
I haven't nailed the concept completely either, but this link: http://www.dartmouth.edu/~german/Grammatik/WordOrder/WordOrder.html, helped explain a lot of things. If you check out Section A. I. d (Qualifiers Non-Obligatory Elements), you'll see that they discuss this distinction; wherein the adverb has been moved the end (after the object). Seems like it depends on the piece of information that the speaker is trying to emphasize. I'd be happy if a native speaker could further elucidate though!
native speaker here.. non-obligatory qualifiers are a bit different. actually, in this case there is no viable way to reposition the word "kaum" without loosing the whole meaning, so emphasis is not really the issue. (one could say "Ihn erkannten sie kaum" instead of "Sie erkannten ihn kaum" or in sub clause structure "erkannten sie ihn kaum" but then the emphasis change is not related to "kaum".. what would change between these sentences is whether subject or object are emphasized. "kaum" is an extension of the verb and it works just like other adverbs (e.g. "nicht", "gut", "vage", ... ). it has to be located after the verb it qualifies, it is part of the (complex) predicate. when "kaum" stands before the subject (and predicate), it changes function and meaning, i.e. it is no longer an adverb qualifying the verb, but would start to qualify the whole sentence/phrase.
When the person (male) is in the dative case.
E.g. She gives him the apple - Sie gibt ihm den Apfel.
Here, Sie (some lady) is the subject. The apple is the direct object (Akkusativ / Accusative). The guy who the apple is being given to, is the receiver of the direct object (Dativ / Dative). Hence 'ihm'.
You'd mostly use ihm, whenever you'd say "to him" in English.
The example I used could also be written as - "She gives the apple to him" (although, you'd normally use the original form of the statement)
Phrases such as "with him", "by him", "on him", etc. you'd use ihm, as they all trigger the dative case.