I randomly became the emperor of the HRE

I was playing a custom character in the 1066 start. I was pretty strong overall, about the same level as Alfred the Great. Won my freedom from the Duke of Mercia and became the Duke of Lancaster. Some time goes by and the HRE declares war on England. Tried my best to help but friendly AI was dumb and outnumbered. So now my liege is a German emperor and I'm just doing my thing, saving money and helping allies here and there. Then the emperor died and I get elected ruler of the HRE. It really caught me off guard since I had almost no interaction with the HRE.