i before e except after c or when sounded like a as in neighbor or weigh.
But there are exceptions. English language orthography is a weird science.