The nomination of a Head Boy and Girl is a common practice in the British Education System (and featured in Hogwarts; one of the few similarities seen between the two institutions). The positions are held by one male and one female student of from the highest year; two seventh-years are chosen every year at Hogwarts.
This title is accompanied by specific responsibilities and duties assigned by the administration in aiding school organisation, school spirit and student discipline. As a rule, the Head Students were usually once prefects. One notable exception is James Potter who, despite not having been a prefect (OP9), was Head Boy to Lily Evans' Head Girl (PS4).
It is not certain whether the selection of Head Boy and Girl at Hogwarts is through a student vote or is the choice of the teachers. It is most likely, however, that it is the responsibility of the administration to choose the Heads, as they also choose the Prefects.