I have a line that I drew where the ends are not connected. I now want to select the two end nodes and hit a button to have QGIS connect them with a line segment. How do I do this?
Activate Snapping (Settings --> Snapping options...). Select required snapping mode and set at least Snap to (To vertext for your case) and some Tolerance value.
Than just edit layer and draw new line segment connecting two nodes. Now when you move cursor close enough to node when drawing line, the line will snap to the node (showing you the pink cross). Distance of snap is depend on Tolerance value.
For more information about snapping see QGIS User Guide
note: You can't snap to nodes which are just being drawn. It works only for already drawn features.