What is ship integrity, and how does it work?

I cannot answer your question fully, but Integrity used to be called "Wear and Tear".

Basically, as you use your ship, it gets damaged simply through use. My understanding is that when it reaches zero (possibly before) your ship modules will start to take damage and eventually fail. This limits the distance you can travel when exploring, but I've never put it to the test. I don't fancy blowing up in the middle of nowhere and losing a ton of exploration data.

As the integrity reduces, previously you would notice the wear and tear in the appearance of your ship. Recently, due to people who didn't want to pay full repair costs but had paid for ship paint jobs that they wanted to keep looking nice, Frontier separated out the Paint Job as a distinct damage attribute that you can repair cheaply.