Thinking to solve the puzzle I came across a puzzle on lichess.org, (Black to move) , I was unable to solve it. But I know the solution now,

I don't wasn't the  solution or analysis. I just want to know how should one think while looking at this position to find the correct path since there are so many options to choose.

]1

Spoiler: solution below
You should always think how the last move played by your opponent has weakened his position.

In this game, f5 limits the mobility of the White king forcing it to stay confined in the g and h files.

That gives black a chance to checkmate using the rook and the queen. If the queen is moved the king can get to the f file and then it would be much more difficult to deliver checkmate. So you move the rook, and the solution is clearly the best choice because it forces white to exchange the queen to not get mated.