One of many buttons, knobs, switches and toggles you can find on any number of gaming joysticks, the hat switch is the name for the small toggle switch typically located near the top of the joystick handle where it can easily be accessed and manipulated with your thumb. Depending on what game you're playing, the hat switch may be a vital tool or mostly useless.
In-Game Point-of-View Control
Hat switches are primarily used to change the point of view or manipulate the camera in-game. To what degree the POV changes depends on the game, with some games merely switching to an alternate camera angle and others directly turning the camera. Hat switches are particularly useful for flight simulators, where being able to look around without changing your flight path can be critical.
Hat switches can also serve other functions, depending on the game. In some cases they're used to navigate in-game menus and make selections, while other times they take the place of directional pads found on some gaming controllers. Some games may assign a specific function to the hat switch that relates directly to the specific game, while in other games the switch may even be mappable in the game's control setup menu, enabling you to decide what role, if any, you want the hat switch to fill.