How did they chose a king in medieval times?

they didnt reallyy chose their king it was kind of like if your father was king then you were automatically goin to be king when he died.