you install an OS on the external hard drive - exactly the same way you would on an internal drive, then while the mac is booting, simply hold down the "option" key and it will show you all bootable drives attached to your mac.
on a PC, you would have to interrupt normal start up and select a different boot device (how this is done is different for each manufacturer).