The suffix -or is from Latin, so it’s usually used for words of Latin origin, such as “inventor”. The suffix -er is the Germanic cognate of the same original morpheme, so it’s usually used for Germanic (mostly Old English) origin, such as “reader”. Usually, but not always. They are both pronounced identically in all standard varieties of English. There are some words that can be spelled either way, for example “advisor” / “adviser”. In answer to your question, educated speakers, who read a lot, know which words take which suffix. Uneducated speakers could easily mix them up. (Actually, a native speaker even managed to mix up “advise” and “advice” right in this forum not too long ago. That mistake is rather surprising, since those two words are not even pronounced the same.) By the way, Persian being an Indo-European language, do you have a similar suffix in your language?
Edited to improve style and fix typos.