The humming sound is caused by the high-speed flutter of the mosquito’s wings. The pitch of the male’s hum is slightly different from that of the female’s. This enables the males and females to locate each other during the mating season.
From the book: Ever Wonder Why? by Douglas B. Smith