What are good practices for picking good keyframes when motion tracking? How are these frames used?
What is an "ideal" keyframe?
I don't think is about having an ideal keyframe but a range of keyframes that have proper tracking information.
You'll get the best tracking out of images that have recognizable, unique features, and those features stay recognizable from frame to frame so that the trackers yield low errors. Blurred images, low contrast or flat colors make for bad tracking. Also bad for tracking are repetitive or similar patterns where the tracker might lock to the wrong place from frame to frame. For 3D tracking it's better if the tracked image that has translation movement and parallax
So, to determine the range of keyframes to be used to successfully solving a scene, you should consider:
At least 8 common tracking points.
Accurately tracked features (or with a low error average)
Parallax or information that clearly describes perspective or any spatial transformation.
Don't use sections with a lot of fast motion blur or where the camera remains stationary. Avoid sections where you have a lot of evident distortions (ie lens distortions or artifacts caused by rolling shutters, compression errors, etc)
In other words: In the Solve section for A and B select the frame range where you feel that the tracking has been the most accurate and has enough information to solve your scene.
If you are unsure, you can let Blender decide what the best part of your shot is by enabling the Keyframe option on the solve tab.
Note that the section of the video clip that will get solved is not limited by the range of keyframes A and B or the auto-selected by blender. The whole shot will get solved (if possible) using the values for lens, distortion, etc determided in the keyframe range.
If a tracked element leaves the frame but comes back later in to the shot, it is very important that you track both sections and then join the trackers so that blender understands that is dealing with the same element and not something new.
For general tips on motion tracking read: How can I get better results when doing camera motion tracking?