There are many spelling rules in English. Here is one.
1) “ie” or “ei”
Rule 1: ‘i’ before ‘e’ except after ‘c’
Examples: receive, receipt,
Exceptions: neither, leisure, foreigner, weird, height, seize
Rule 2: If the sound is “ay” the spelling is “ei”
Example: neighbour, eight, weight, freight