Usually drivers are going to test that limit in an area with less risk, for example a corner with lots of paved runoff. But small factors such as the ambient wind changing direction, or the sun coming out or going behind a cloud, can affect grip enough that the limit changes enough to catch a driver out. In these cases there's usually warning, that the car very slightly stops responding as exactly to your inputs as it was the lap before.
However the most common scenario for a single car shunt is when the driver is testing the track limits; for example riding 3 inches of his tire over the kerb instead of 2, or using up the edge of the track to where the tire is now on a painted line rather than bare asphalt. In these cases there is often no warning, the car just steps out.
Plus, 4 tyres may have different traction depending on car balance (braking, accelerating or cornering), downforce (nearly zero at 50km/h but at 300km/h F1 car is on rails, and different for the front and the rear), track specifics (for example, most clock-wise tracks put a lot of pressure on the front left tyre) and many little other things. It's really complicated.
If you watch the practice for the race coming up shortly in Australia, you'll see one corner in particular where pretty much everyone including the fastest guys slid off the track. So a lot of it's a feel thing, but you've also got engineering data telling you all the measurable stuff about how the car is performing, which you can then feed into a computer simulator which knows the exact (one hopes) layout of the race track.
One of the younger guys who qualified surprisingly well supposedly spent hundreds of hours on a PC simulator before this latest race.
I don’t know if they have any on-board telemetry to measure this.
Is there some sort of feedback when you're really close? I've only had a couple of track days, never came close to understanding it.