I can help you there, as I do that job.
Let's assume there is a pass mark (this isn't the case at all grammar schools - they just work their way down the lst)
In your example, 500 children pass the test. Yes, the names of all 500 are passed, in rank order, to the local authority.
Let's assume that the school in question has 150 places. It is exceedingly unlikely that it will work out as the top 150 will get a place, leaving 350 on the waiting list.
This is because of those 500 who have passed the test at school A, a significant number will also have passed the test at school B, and school B will be their preferred school.
So, let's say that of those 500, 200 have been offered a place at a higher ranked school, leaving 300 available to school A. The remaining highest ranked 150 will be offered places at school A, leaving 150 on the waiting list for school A.
I'll make that do for now - but there's more! Lots more! Post again for more info if you want it.