First, we annotate the genome – we identify where genes start and stop, and look for interesting sequences. This can be done manually or, preferably, it can be automated. We can then compare our annotated genome to the known genome of a closely-related or similar species to look for similarities and differences. The species don’t have to be that similar, either, as a lot of genes are the same or very similar across a lot of living species. Once we’ve identified differences, we can investigate the effects of these differences using sophisticated tools and techniques. Once we’ve compared our genomes and gathered our data, we can draw conclusions about the extent and significance of the differences.
Once the genome is sequenced, the real hard work begins – trying to figure out which sequences are responsible for the traits you are interested in. There are several ways to go about doing this. As the Wren said one way is to compare the new genome to another species which has already had its genome sequenced and in which we know the function of certain regions. This strategy, however, is not perfect as it requires a major assumption – that the genes are doing the same thing in the different species. It is therefore not particularly useful for finding out the genetic origin of traits that are unique to your species! Still, it is usually a good start for many genes. However, to truly identify the function of any sequence a lot more experimental work is needed. These experiments can include ‘knocking down’ the function of certain genes and observing their effects on the animal, or likewise ‘knocking in’ extra copies of the gene to observe the function. Scientists are continuously coming up with new methods to try to answer your question and in a few years there may be new methods we don’t even know about yet!