How does the squat switch work? This question came up after reading the following comments on the answer to this question: Raising the flaps right after touchdown. Good or bad?

Philippe Leybaert Jan 20 at 23:00


  The retractable landing gear is an excellent point. It makes perfect
  sense. I've read a few stories of pilots retracting the gear after
  landing instead of raising the flaps.


voretaq7♦ Jan 20 at 23:02


  The retractable landing gear issue is particularly notable because
  early in the landing roll you may not have enough weight on the wheels
  to activate the squat switch that prevents you from retracting your
  gear while you're using them to hold the plane up. Your perfect
  landing could turn into a nice, smooth gear-up incident if you bump
  the wrong switch.


Questions


How does the squat switch work (which prevent gear up on the ground)?
Are there any reports on issues of gear up on ground? (I only know
one)?
The squat switch is essentially a sensor that senses if the weight of the aircraft is resting on the gear. This can be done by load cell or displacement sensor on the suspension arm.

Like any other component these sensors can fail though engineers prefer them to fail in an always on (weight on the gear) state; that way the pilot just needs to deal with gear failing to retract after takeoff and needing to land again to check it out rather than dropping the plane on the ground and causing more damage.