I kind of just assumed this was the case. It's possible that Buffy listed Giles' number for contact info. It's possible they tried Joyce's number but Buffy wasn't there. I just assume the hospital had Giles and Buffy as contacts.I could easily headcanon that Giles and/or Buffy requested that Buffy be contacted if/when Faith woke up. This would be both a compassionate act (that Faith wasn't forgotten) and a sensible precaution/heads up to potential danger (which is actually what happened).
@thrasherpix - You nailed it.I just always assumed that it was the cops.
The Mayor hasnt been dead a year and i bet he still has a few loyalists on the force. I am also sure he left more than one 'surprise' for Buffy in case she killed him. Richard strikes me as a very bad loser.