How do mosquitoes orientate in the darkness?
What is the purpose of their loud, annoying sound?


Both males and females produce a sound when flying but not at the same frequency. I would think of the male sound as mainly an artefact of flying and don't really know if it has any usefulness. I would note though that before mating both gender tend to synchronize their sound (Gibson and Russel 2006). On the other hand males are very attracted toward the sound of females. 

In nature, mosquitoes make swarms. Male's job in the swarm is find find female, courtship and mate. This means that males need a cue to detect them from far away and this cue is their sound. Males evolved large and fluffy antennas (with which they hear) while females only have small antennas Charlwood and Jones 2008.




  How do they avoid obstacles?


They have eyes! It is never complete darkness and they just move around, see things and sometime bump into something and keep flying until they reach their goal.

I can't offer you a citation for that but as I worked with mosquitoes in the past, I think it is a good description.