Many problems with sliding patio door screens not moving well and popping off the track can be attributed to broken or rusty rollers (wheels)... However, there is a common situation that causes the screen to become repeatedly dislodged... and, there's nothing wrong with the screen.
The screen moves along a small track parallel to the stationary panel of your patio door. Over the years, this stationary panel can shift slightly outward at the bottom and encroach upon the screen track, interfering with the path of the screen. When the screen gets to this point, it pops off.
The solution is to move the encroaching bottom corner of the stationary panel back into position and attach a bracket to prevent a reoccurrence.
This may not be as easy as it appears. Often a utility bar and/or a rubber mallet is needed.