While trying to formulate an answer to this question, I realized I really have no idea how Ramanujan came up with his formulas. Bruce Berndt has a number of great expository articles, e.g., this one, but I couldn't discern *how* Ramanujan approached problems. There are famous stories about how solutions seemed to just pop into his head, e.g., when he quickly solved a tricky problem and was asked how, he responded:

It was clear that the solution should obviously be a continued fraction; I then thought, which continued fraction? And the answer came to my mind.

According to Wikipedia, Hardy said Ramanujan's results were "arrived at by a process of mingled argument, intuition, and induction, of which he was entirely unable to give any coherent account." In the same article, Ramanujan is quoted as saying "An equation for me has no meaning unless it expresses a thought of God" and crediting his mathematical abilities to his family goddess Namagiri Thayar.

Previous MathOverflow questions have asked how he came up with specific results, and in this mathoverflow question, Tim Chow said "Ramanujan is legendary for having an extraordinary, uncanny intuition, and it is natural to try to understand this intuition better."

Question:Now that so many of Ramanujan's formulas have been verified, that his notebooks have been carefully studied, and that his results have been understood as a part of a larger theory, has anyone discerned a pattern or a set of standard tricks/approaches that might have been underlying how he came up with his results?

What I've read from Berndt suggests that Ramanujan's work focused heavily on continued fractions, partition functions, asymptotic formulas, modular forms, zeta functions, $q$-series, Eisenstein series, and mock theta functions. I'd be happy for an answer in any of these individual areas. Berndt suggests Ramanujan worked on slate, and erased his work when finished, recording only the final formulas he discovered, so we can perhaps deduce that Ramanujan had some fairly compact way to do his work.

Side note: while it's fun to have stories of mathematicians so brilliant that no one can understand them, I don't think this is the right point of view if we want to make the field welcoming to newcomers. It's also not very satisfying from the point of view of really understanding what's going on in a field. I hope that one day the mathematical community will understand everything Ramanujan did, and now, 100 years after his death, I'm hoping there has been some progress on this goal.