Let's start with the type you're more likely to use. HDMI switches, like network switches, allow you to connect more HDMI devices to your TV than you can out of the box. If your TV only has two ports but you want to have four gadgets hooked up, you connect a switch to one port on your display, then plug the other units into the switch. The TV sees this as a single input, while the switcher handles which one outputs to the screen.
This way, you avoid having to unplug video cables to make room for others all the time. Along with the convenience, it also reduces wear and tear on the port. It's not great for an HDMI port to constantly have a connector plugged and unplugged; plus, the more often you do this, the higher the chance that you'll pull it out improperly. If a switch wears out from constant connections, it's much cheaper to replace. As a bonus, it also reduces headaches if it's difficult to reach behind your television to swap cables.
Switches change inputs through automatic detection, buttons on the unit and/or a remote. Auto-swapping is convenient, but it can also happen when you don't want it to. Nearly every device today stays in a low-power mode to download updates and provide instant availability, which can confuse switches. Definitely get a model with a remote, since getting up to change the signal every time is no fun.