The colors or numbers themselves are often a clue, but they alone may not provide sufficient information. There is always the trial and error method, but I do not recommend that because of the potential for destructive results. Instead, the Motor Doctors suggestion is to equip yourself with an ohmeter (don nott settle for just a continuity tester) and learn to perform a few simple tests with it.
For some kinds of motors, principally motors with terminal-based connections, basic wiring is self evident. The terminal board itself usually has markings that indicate where line one and line two are to be connected. But what if you need to reverse that motor, use a different (but available) voltage setting, or have a motor that has nothing more than a bunch of color-coded or numbered leads coming out of it?