The Y chromosome in Drosophila is a strange thing, and it has several unique features. While, just as in humans, male flies are XY and females XX, flies differ in the the Y chomosome doesn't determine "maleness". Rather the sex of the fly is determined by the ratio of X chromosomes to the number of sets of autosomes (the X:A ratio). If the X:A ratio is 1, then the fly is female, if it is 0.5, the fly is male. So an X0 fly (i.e. one with a single X chromosome with no Y chromosome) develops as a male. [This can be quite useful in the laboratory] What then is the Y chromosome for? It is required for male fertility but not viability. This means that XY flies are fertile males, XX fies are fertile females, XXY flies are fertile females and X0 flies are sterile males.
One might expect then that whatever genes are located on the Y chromosome are related mainly to fertility, or are genetically redundant. In fact there are very few known genes on the Drosophila melanogaster Y chromosome - 12, in fact, and many if not all are related to fertility in males. 12 genes is really not many for a chromosome, and it turns out that the Y chromosome is pretty much composed of genetically inert heterochromatin and largely comprises simple sequence repetitive DNA.
The figure below (source) shows male (a) and female (b) karyotypes. The Y chromosome is labelled in (a) - notice that it stains particularly darkly.
The highly repetitive nature of the Y chromosome means that the Y chromosome sequences of the 12 sequenced Drosophila species are less complete that the sequences of the other chromosomes. Of these, perhaps the best quality is that of the Drosophila melanogaster Y chromosome, for which the catalogue of genes is thought to be complete. This paper compares the D. melanogaster Y chromosome with those of the other 11 sequences species of Drosophila. Note that the two closely related species persimilis and pseudoobscura differ from the others in that the Y chromosome became part of an autosome in that lineage. The pattern of acquisition of the D. melanogaster Y chromosomal genes is shown in the diagram below:
The red arrows indicate acquisition of genes on the Y (these are found on autosomes or X chromosome in the other species); FDY is a special case, and resulted from a duplication of an autosomal gene in the melanogaster lineage after it split from the simulans lineage. Presumably the other Y chromosome lineages show acquired loci.
The data presented here don't support specific hypotheses as to why genes move to the Y at such frequency. However, it seems clear that a chromosome with so few genes, but with a high rate of gene acquisition must be evolutionarily young.
Leonardo B. Koerich, Xiaoyun Wang, Andrew G. Clark, Antonio Bernardo Carvalho (2008). Low conservation of gene content in the Drosophila Y chromosome Nature DOI: 10.1038/nature07463