Light and fan not working - is the wiring correct?
it looks like the earth has come completely off, but I wouldn't expect that to have caused the light and fan not to work...or am I wrong here?


No, you are correct, the earth is not needed here as there are no extraneous conducting parts exposed.

The earth wire, or circuit protective conductor (CPC) is a safety element and does not affect normal operation of the circuit when there is no other fault present. 

Switch housings are normally plastic and non-conductive. If the fixed part of yours is conductive metal, the earth wire should be connected to it. Otherwise I would leave it alone.


  Do I connect the earth into the only obvious connector?


No, at least not if you think the normally-connected side of the switch is an obvious connector. That would be a recipe for tripping a breaker or setting fire to things.

You could, after turning the breaker off,  remove the wires from the switch completely and then test for continuity across those terminals using a continuity tester or multimeter. This would tell you if the switch is OK. If it is, I would reconnect the wires firmly and look elsewhere for the problem.

It is likely that the red wire is a permanent live and the black is a switched live (an unhelpfully inventive electrician may have wired it vice versa) - if so, the black wire should have red tape around it to indicate it is switched-live and not neutral.