Doctors often rely on signs and symptoms along with patient history to make a diagnosis. They actually make a differential diagnosis. This means they carefully consider all the possible causes for the symptoms.
For example, pregnancy can cause carpal tunnel syndrome (CTS) but if you aren't a woman and you aren't pregnant, that's not likely going to be the problem. Diabetes can cause CTS but if you don't have diabetes then that's not it.
Sometimes a neck problem can refer pain to the hand. But if you have normal neck motion, no history of trauma or accident, and normal X-rays then cervical spine disorder can be ruled out.
The doctor goes through each possible cause of CTS and looks to see if any of these might be a match for you. Additional tests can be done. These include sensory testing, and nerve conduction velocity (NCV) tests. The doctor can also conduct some specific tests on your wrist and hand to look for CTS.