A lot of this is from EU3 but I don't believe it's radically different in EU4 now,
The starting electors are set in stone, but can change if either an elector is eliminated or if the emperor revokes it via war. New electors are chosen by the current emperor.
Any christian country with a monarchy in the world is eligable to be the emperor, however in practice you will only ever really win if you are part of the empire. Electors vote for whoever they have the highest opinion of. In EU3 there was a very large boost if you had a lot of land in the HRE, I don't know if this was carried over but it was significant in determining if you could win the throne.
Electors will not vote for heretics (not their christian type), and the best way to get them on your side is generally bribes, prestige, improve relations, etc. Check the voting modifiers to determine what you can improve. If all else fails the old strategy used to be to vassalize troublesome electors which provides a massive bonus, again I'm not sure if this has carried over.
Once Emperor, you are emperor for life and your heir gains a bonus from your imperial authority towards his bid for the election. Additionally you gain a significant manpower and forcelimit bonus as well as bunch of other goodies, you can also pass reforms that further centralize the Empire eventually culminating in making it hereditary, vassalizing them all, and then assimilating the entire empire. This may have changed but is easily checkable via the various decisions in the HRE menu, just take a peek at their effects. You also get a CB if anyone attacks anyone in the empire, amongst other things.
Hope this helps.