A common question is "how do I write a device driver for my device which is connected over the serial port?" The answer depends on if your device conforms to the serial device numeration protocol (officially titled "Plug and Play External COM Device Specification"), found here on WHDC. One interesting "quirk" about the Windows implementation of this protocol is that detection is performed automatically at boot, but then becomes manual (to manually search for devices goto device manager choose Action -> Scan for hardware changes)
But what is the serial enumeration protocol and where did it come from? It is certainly not black magic (nor very complicated). You can see it's implementation in the WDK serenum sample (<WDKROOT>src\kernel\serenum). As far as I know, the specification has its origins in how the original Microsoft serial mouse was detected and grew from there. Of course, the way Microsoft serial mice are detected could have been based on a previously existing detection scheme, but my knowledge about it does not go back that far ;).
The enumeration protocol is simply (skipping over device class specific checks)