The menu extra is implemented as an NSStatusItem, as in this Cocoa Dev Central tutorial which shows how to run a menu extra that updates with recent music played from iTunes.
The AIM implementation uses the C code from Fire.app -- the open source Mac OS X multi-network IM client. Thank goodness for the GPL, that's what I say. (And that's why I'll be publishing the code to the client when I start distributing it.) It's worked extremely nicely indeed, and I mean to do a tutorial about which bits you can safely strip back and which bits you can't, if you want to embed an IM client in your Cocoa application (the abstraction layers in Fire aren't entirely clear).
The rest of the code is my own dodgy Objective-C, which I've not really written before but is proving quite okay, thanks.