Flame tests are an important part of qualitative analysis in chemistry. In particular, they are a way to test for the presence of a variety of metal ions. Many metal ions colour a flame with a characteristic colour. To be more accurate, an emission spectrum is taken which will show characteristic lines associated with each element but most commonly in schools the colour is simply judged by eye.
There are various methods of carrying out flame tests.
You can find out more information here.