Migrating from foo.com/wordpress/ to foo.com/ — how can I do it?

You have to change Settings -> General -> WordPress Address (URL) and Site Address (URL) in the old installation.

WP looks in the DB at these settings and creates dynamic links, etc, from there, so you need to change it in the DB (either through these settings or by editing the db manually.)

Another option (and, actually, the better one) is to use a plugin which changes the links in the entire db – this will keep all of your links, images, etc. working properly.

I’ve used Velvet Blues Update URLS before many times, and it works perfectly. http://wordpress.org/extend/plugins/velvet-blues-update-urls/

Just remember – if making this change with the WP backend (through the settings page or with a plugin), you should do it on the old site. Then it should be immediately accessible at the new location. (Or you could just move your files to the new location, preserving your themes, media, etc.)