I almost hesitate to ask this, because it is hard to believe no one else asked it; but it isn't showing up in the "similar titles" list.
What is special about 'C' that switches the 'IE' immediately following it?
Basically, English vocabulary is a mix of mostly proto-Germanic and proto-French, the languages in use by the Saxons and Normans respectively during the Norman invasion and occupation of the British isles. To this was added hefty dashes of classical Latin and Greek, and then Romanizations of words from all over as words were borrowed from British colonies and from American immigrants.
Anyway, in German, the rule (when explained to native English speakers) is that when I meets E, the second vowel is the sound of the pair, and is sounded long. So, EI is sounded like "aye", and IE is "ee".
In French, it's not so simple, but usually, IE is "ee" and EI is "ey" (long a). It's really closer in most cases to "eh", but that's far more open than the "eu" or schwa sound that is an unattended "e".
So, from both these languages, when "ie" is a monopthong (or "digraph"; two letters making one sound), it's usually "ee", and then "ei" is normally given its French pronunciation of long "a" or similar (as in "neighbor" or "weigh"), with a few exceptions usually given the Germanic long I.
The mixing in of C also appears French; the word "deceive", for instance, is rooted in the old French deceivre, identical in meaning. The French would use their normal long "a" pronunciation for "ei", but in the transition to modern English it became "ee". Words such as "receive" and "ceiling" also have ties to French, though sometimes, as with "ceiling", the spelling in the other language isn't anywhere close.
So, that's the origin of the rule; when I and E meet to say "ee", both of English's parent languages usually indicate "ie". The "except after c" is because we Anglos butcher the French contribution so badly, and the "or when sounded as 'ay'" is for the rare occasions we get it right.
Now for why it's not such a great rule:
The largest section of exceptions to the full rule, "I before E, except after C, or when sounded like 'ay', as in 'neighbor' or 'weigh'", is when "ie" or "ei" is not a digraph, but instead a diphthong. The word "science", and its various derived words, do not have their "ie" pronounced as long "e" OR long a; it's two elisioned sounds, "eye-eh". Same with "conscience". Similarly, words like "deity" are pronounced "ey-ih", again pronouncing each letter. Most of these are from base Latin or Greek roots instead of French/German.
The second biggest group of exceptions are words that have evolved multiple acceptable pronunciations: "either" can be pronounced "ee-ther" or "eye-ther" depending on dialect. Similarly, "neither", "geisha", "leisure", "weird", etc. all have multiple acceptable pronunciations of the digraph.
Recent additions to the English language, borrowed from other languages, are likely to also be exceptions to the rule; "gneiss" for instance.
Finally, the plural form of a word ending in "cy" such as "fancy" or fluency" is always spelled with "cie" ("fancies", "fluencies").
Well, the rule isn't true at all. There are more exceptions to the rule than that follow it.
According to QI, 923 words have cie (against the rule), 23 times more than cei (following the rule).
There is nothing particularly special in principle about the letter <c> that makes it affect the spelling of a following digraph. "I before e except after c" is not really a rule, but rather a mnemonic intended to remind people that the sound /iː/ is irregularly spelled as <ei> in one root that happens to show up in a number of relatively common words: receive, perceive, conceive, deceive, receipt, conceit, deceit. These words all have <c> before the <ei> because they are all related to each other (although they are also related to some words spelled with <cept>, where the vowel is pronounced and spelled differently). The unrelated word ceiling also happens to have <c> before <ei> = /iː/. And that's basically the entire basis of the mnemonic. If we didn't happen to have words derived from the -ceive/-cei(p)- root, or if the words derived from this root had gotten different standardized spellings (e.g. with <ea> instead of <ei>: spellings like <conceave> were in fact used in some Middle English texts) then we presumably wouldn't have the mnemonic.
As critics of the "rule" are fond of pointing out, there are a few more words where /iː/ is written <ei>, like seize, and for some speakers weird (since the vowel in this word is r-controlled, different speakers identify it with different vowel phonemes). This use of the <ei> digraph comes from French and isn't in principle restricted to occuring after <c>: it's just a very uncommon spelling pattern in present-day English, so there aren't many other examples of it. The use of <ei> as a digraph for a sound like /i/ or /iː/ may be more common in other times or places: e.g. in Scots spellings like <deid> (= standard English "dead").
It's not a matter of <c> causing an immediately following <ie> digraph to "switch" or anything like that. As the comments and other answers mention, there are many words are written with <cie>, with various pronunciations. In particular, <cie> is common in inflected or derived forms of words ending in <cy>, because of the tendency to change <y> to <ie> in certain contexts (a "rule" that is actually productive and applies to a great many words, unlike the "i before e except after c" mnemonic).