Note: Recent versions of the satoshi client offer a 'debug window' which can be used to export private keys. This is described in Miguel Moreno's answer to this question, and is easier than the steps I describe below.
To export a private key from your satoshi client:
you need to define a username and password in bitcoin.conf in the same folder as wallet.dat; this only needs doing once; you may have to create the file; add the following lines, changing the username and password to whatever you like:
rpcuser=someusername
rpcpassword=somepassword
run: bitcoin-qt -server and wait for it to load the blockchain and start up
if your wallet is encrypted, run: read -s x; bitcoind walletpassphrase "$x" 600; unset x to unlock it for 600 seconds (type your passphrase after hitting return, then hit return again; this 'read; ...; unset' prevents the password being written to your shell's history file on disk, and the '-s' in read prevents your password being displayed as you type it, and improves protection from screen-loggers and the shell log)
run: bitcoind dumpprivkey 1my1bitcoin1addres11111 (replace 1my... with the bitcoin address of which you want the private key)
if your wallet is encrypted and you want to re-lock your wallet, run bitcoind walletlock