Why are 'electric', 'electricity' and 'electrician' pronounced differently?
Solution 1:
The reason for the difference is the phenomenon of Palatalization. In late Latin, the /k/ sound (written 'c') gradually changed if there was a front vowel (such as /i/ or /e/) following. If you listen carefully while you say the words 'cut' and 'kit', you will find that the /k/ sound is different in the two cases, because the back of your tongue is already raised for the /ɪ/ in 'kit'. Over time this difference became greater until the sound became /t͡ʃ/, (the sound in English "Church"). This sound remained in Italian, but moved further to become /s/ in French. English took a lot of its words and its spelling from French, so this is why in English, 'c' usually has a /s/ sound before 'i', 'y', and 'e', and usually a /k/ sound otherwise. This is why "electricity" has a /s/ sound rather than a /k/.
Later, within English, when that /sɪ/ sound was followed by another vowel, it tended to become /ʃ/ (the sound at the beginning of "ship"). This is why "mission" and "official" both have /ʃ/ rather than /sɪ/ in them. This is why "electrician" has a /ʃ/ sound.
Note that I've described this in terms of writing, but actually these processes happen even without writing. Romans in the street would pronounce 'locus' with a /k/ and 'loci' with a /s/, even if they couldn't read: they just knew that that was the pattern of the words, the same way that we know that that heard ends with a /d/ but looked ends with a /t/, whether we can read or not.
For the final point: the set of endings -ic, -icity, -ician are well established and in some cases were taken from French as a group. (French has -icité, rather than -icity, but that's a detail). Even though electric and its family were coined after the period when English was taking these sets from French, the pattern existed, and people simply applied to the new word.
Panicky is different, though, because it's coined in English, with the English suffix -y. Suppose you wanted to apply this same suffix to electric: You would say electric-y with the /k/ sound, and if you needed to write it, you would write electricky.
Solution 2:
This is due to a linguistic process known as velar softening. It softens the velar -- /k/ in "electric" -- when it precedes a front vowel (/I/ in "electricity").
Read this paper by Morris Halle on Velar Softening and this one by Prof. Yehuda N. Falk for details.
Hope that helps!
(Sorry, no IPA atm.)