How do I keep the "detected" state ON in a PIR detector until a human has left the detection area
PIR sensors do not actually sense the presence of a person, they sense the motion of some large thing that has a significantly different temperature than the surroundings. If a person stops moving then a PIR sensor will not detect the presence of the person; that's just a fundamental characteristic of the sensor.