If you're looking for an example how this can be done, grab the current development version of wordpress. It's already everything in there you might need / can imagine.
If you don't want to make use of 3.1 but 3.0, use the 3.1 code as the example you're asking for. The user bar is located in admin-bar.php and class-wp-admin-bar.php.
Your theme needs to support
admin-bar and the code takes care on it's own by point-cutting the
wp_head hook - which you should have in your theme in any case. Script and CSS styles are named 'admin-bar' as well.
So it's basically copying over the files to your site, enabling theme support for it and if there are some 3.1 only functions used therein, work around those. You can additionally move those files to your theme, rename functions and classes to reflect your namespace to have this a bit more separated.
A benefit to make use of that is that your site will be compatible when updating to 3.1.