The duchies, palatinates, landgravates, and marches, ie, those states ruled by an Imperial Prince, were the king's direct vassals. So he had the right to appoint/depose their rulers. The Princes however felt that these offices were also hereditary; so while they acknowledged the king's right to dispose of them as his fiefs, they also demanded that he follow the rules when doing so.
These rules were frequently stretched and broken, but were generally: 1) Imperial fiefs must be regranted within a year & a day; 2) The king cant just annex the vacant fief to the royal lands but must appoint a new prince. The best way around this was to install a royal family member, thereby bringing the duchy into the royal house but still technically obeying the rules. It was ok if the king retained a duchy he held prior to election, like the Ottos in Saxony and Salians in Franconia.
If the king disregarded the rules it excited the princes and encouraged them to unite against him. Also, any nobles who felt their legitimate claim to succession had been passed over were likely to revolt. Plus, the king generally needed a reason to depose a prince, like a rebellion or a violation of feudal or tribal law, and traditionally required a vote of the Diet or at least support among some of the other princes to proceed.
The best example of a strong king who bent the rules to his advantage was Conrad II; himself Duke of Franconia & King of Germany, Italy, & Burgundy as well as HRE, he installed his son Henry III as Duke of Swabia, Bavaria, & Carinthia. Technically he hadnt combined all these duchies in his own hands, but yet they were under direct control of the royal family, which thus had a tighter grip on Germany than ever before or since.