Always very tricky, and trust me it wont get easier.
If you know someone has just missed out getting somewhere they want to go, try and keep the fact you've just got an unconditional to your dream uni quiet. Give them hugs, chocolate, remind them that all they need is one offer (or if it doesn't look like they'll make that then big up all the experiences they can gain on a gap year). Remind them that they picked all 5 unis they put down, so there must be something great about all of them, remind them what a fantastic uni there second choice is etc. etc.
Also when it gets to results day, it will be worse. People will have their offers and have missed out on them by maybe 1 mark. Here, you need to let them cry! I cried for a good 3 hours non stop on results day as I had missed out on my first choice uni! However, you can remind them how awesome their second choice is (I absolutely love Glasgow, it is amazing and I'm so glad I came here), or if they are impromptu gap yearing, talk about all the exciting things they can do, places they can travel to. If you are all going out as a group in the evening, try to make sure they come along, but if they don't feel like it, then let them stay at home (I personally found it pretty miserable sitting in a pub with some people saying "I only got A* A* A* A" when I would have killed for a few more marks to have got me into my first choice, however once alcohol started flowing I cheered up).
At the end of the day, what you've got to do is remind them, it's not the end of the world, gap years aren't a bad thing, and that you are there for them no matter what.
Oh and if they don't get any offers, don't say "you can come and visit me at uni" because that's just rubbing the fact you got offers in their face!