Question: I would like to be able to change the output device sometimes, for example to switch between headphones and speakers, without having to use the mouse.

I've figured out how to focus the 'status menu' area (top-right of screen) with a keyboard shortcut (default is `Ctrl`+`Fn`+`F8`), and can select the sound menu.

But when I try to select items in that menu, pressing the arrow keys will only alter the volume (even with modifiers like `Cmd` or `Alt`). Even `page up`/`page down`!

How can I access the rest of the menu with the keyboard and change the output device?

Answer: 
YMMV, but because

1. I can’t rely on having a fixed list of sound sources when I plug & unplug screen & DAC from my macbook
2. [switchaudio-osx](https://github.com/deweller/switchaudio-osx) exists
3. I use [Apptivate](http://www.apptivateapp.com) for my keyboard shortcuts

My solution is:

1. Install [switchaudio-osx](https://github.com/deweller/switchaudio-osx) e.g. with `brew install switchaudio-osx`
2. Use `SwitchAudioSource -a` to show me exactly how all my speakers are named.
3. Create some 1-line AppleScripts, saving them as applications:

`do shell script "/usr/local/bin/SwitchAudioSource -s 'MacBook Pro Speakers'"`
4. Use Apptivate to give the saved AppleScript app a keyboard shortcut.

As mentioned in other answers, there are other [popular alternatives to Apptivate](https://alternativeto.net/software/apptivate/) for assigning a keyboard shortcut to an AppleScript application.

Using SwitchAudio has the advantage of not relying on UI list positions. A big help if your list changes. Run `SwitchAudioSource` with no options to see help text.
The first answer to [Using Apple Script to Manage Sound Output Selection](https://apple.stackexchange.com/questions/217148/using-apple-script-to-manage-sound-output-selection) describes how to use an AppleScript to swap between two output devices. This works for me without modification.

There is also [Applescript: "can't get tab group 1 of window"](https://apple.stackexchange.com/questions/209352/applescript-cant-get-tab-group-1-of-window-el-capitan) which sets to specific devices. It is rather old, so may need some debugging.

Once you have a working script, there are various ways of running it with a keyboard shortcut. The simplest is to use [FastScripts](https://help.redsweater.com/fastscripts).