Focus is the keyboard user's cursor. My rule is that it always lands somewhere sensible: one stop per widget, home again after a detour, and shortcuts that say they exist.
A group of controls is one Tab stop. Arrow keys move inside it, Tab moves past it, and coming back lands on the control you left. Five buttons shouldn't cost five presses of Tab.
Opening a dialog moves focus into it; closing it puts focus back on whatever opened it. Without that, a keyboard user who closes a dialog starts over from the top of the page.
Show the key next to the action it triggers, and keep a cheat sheet behind ?. Scope single-key shortcuts to where they apply, so typing a “j” in a search box never moves a list.