A lot of games will automatically switch between keyboard and gamepad when a gamepad is connected. Perhaps this is some automatic background function that SDL handles.
https://docs.microsoft.com/en-us/windows/win32/xinput/gettin...
In general, "notifying the program when a new device has become available" seems to be a surprisingly difficult problem. I've encountered trouble with multiple device types across multiple platforms.
But you can also manually enumerate devices as in the example here: http://wiki.libsdl.org/SDL_GameControllerOpen