Five Hebrew letters -- כ, מ, נ, צ, and פ -- have different forms when at the end of a word. I have heard that this is true for certain letters in Arabic too, though I don't know if they're the "matching" letters. My question is about Hebrew, though Arabic might be related.
Why do any letters have final forms, and, given that some do, why these five in particular? Is there a linguistic reason, or is it a quirk of history, or something else? None of the "regular" forms seem like they would be any harder to read at the end of a word than elsewhere in a word, at least in the scripts I'm familiar with.