There's two main ways that a doctor can find out what you're allergic too.
Those two different tests for allergies are skin tests and blood tests.
With the blood tests the doctor will draw blood from you and then send it off to be analyzed to find out what you may be allergic too and for the skin test the doctor will place a tiny bit of an allergen such as food or pollen on your skin and then prick the outer layer of the skin or make a small scratch on your skin to test for allergies.