I think you eventually develop an intuition with this.
I agree with 77ecos in that the first thing you need to do is analyze your play. If you played well and suffered bad beats, that's one thing. If you played poorly, then it's back to the drawing board. Review your mistakes and strive to improve.
That said, somedays the run bad feels self-evident. It's fine to persist when it costs you nothing -
freerolls for example - but even repeated defeats/losses in FRs can bring you down mentally.
So, as I noted above, try to develop an intuition about running bad. What I have noted is when I withdraw from play (I am a stick-to-it type) because it does not feel positive...you often become aware
a little later, you feel particularly tired or a little under the weather, and that can 'explain' the poorer results combined with the run bad.
I now try to equate closing out a poor session early in a similar way to folding. Whilst it might not feel like the optimum play in the moment...it is profitable in the long run.