Some words end with -or:
Others end with -er:
Or with -ar:
Why is this the case? Is there a way to determine which should be used for an arbitrary word?
From Oxford English Dictionary:
The distinction between -er and -or as the ending of agent-nouns is purely historical and orthographical: in the present spoken language they are both pronounced. In received spelling, the choice between the two forms is often capricious, or determined by other than historical reasons.
"Modern English Usage" by Fowler:
The agent termination -er can theoretically be joined to any existing English verb. In practice, many such words (and there are about 100 of them in common use) have -er as a termination and others have -or.
Scholarly attempts to account for the distribution of the -er and -or forms continue to be made, but the problem remains unresolved.