Normally, some percentage of the population will get HIV in any given year. So what you do is give a bunch of people the shot and track them long term. You count how many got HIV after N years, compared to what would be expected in a normal population.
Nobody is exposed to HIV as part of the study, that exposure would come through the participants living their ordinary lives.