Many of today's IM clients add things during installation so that they can be detected by web pages. Most of them use a fairly standard technique to do so; they install an ActiveX object, which can be detected by IE, and register a MIME type than can be detected by Firefox/Mozilla. I took a few minutes and put together a page that checks for all of these various object and types, and it's able to detect most of today's major IM clients fairly reliably. (Google Talk's detection mechanism doesn't allow detection from arbitrary web pages, and I couldn't find any info on ICQ). The result is displayed in a table like the one above (just an image, not live detection).
Try it out on your system, and please leave a comment if it didn't work or returned incorrect results for you (there are some known issues in Firefox). If you're curious about how it does its thing, please check out the source for the page - it's really quite simple once you know the CLSIDs and MIME types to look for.