Step 1: Pick the Right Tube Size
You need to know two dimensions of the tube size, the diameter of your wheel/tire and the width of your tire. These dimensions can be found in both Standard English Sizing (example: 29x2.20) or ETRTO (example: 56-622) and can be found on the sidewall of your tire. Find the tube that has the same diameter as your tire/wheel and the tube that falls within the range of your tire. Tubes will stretch to fill the inside of the tire and therefore come in a width range (example: 29x2.00-2.40).
Step 2: Pick the Right Valve Stem
There are two main valve types, Presta and Schrader, and need to be chosen based on the wheel the tire/tube is being fitted to. Presta valves are longer and skinnier than the Schrader valve and are typically metal with threads and have a valve core that you unscrew to allow air in and out. Schrader valves are the larger valve that is more recognizable to most people due to them being "car air valves". Make sure to double check the tire and tube you require before purchasing to avoid having to return/exchange for the right tube or having a malfunction up installation.