Look to see if any ground wires are present in the junction box. If any, attach to them and also attach the metal box to them.
If no wires but an obvious metallic pipe entering box, then attach to the metal box via a #10-32 screw; they sell suitable green-painted screws 10 for a buck, or 10 for $3 with cute little ground pigtails attached.
If no evidence of any ground, then hmmm. Leave it detached; this is better than "islanding a ground", which wouldn't actually ground anything and would only cause the islanded locations to share ground faults.
Blue and Black
One of them powers the fan. The other does nothing; or it powers a light which you haven't mentioned.
If you want the thing switched by the switch, attach it to the switched-hot wire. Your other option is to connect it to always-hot and let it run 24x7 or control it via another means.
Given that you only have one light switch, it appears you must switch fan and light together, unless you want to obtain some sort of remote or smart switch with a companion fan module up there, and use that to separately control fan and light. In that case, ask how to wire it - it'll be quite different.
Building Codes absolutely require that a light switch, in the obvious, usual location, operate a practical light in the room. That is not to save you from yourself, that is for the safety and benefit of your guests and to help first responders do their job.
The only exception to the "light switch" rule is if you are willing to hardwire the lighting on and burn it 24x7, but a nightlight won't do, it needs to be practical room lighting.