The Fourth Joyful Mystery, the Presentation in the Temple.
It was the custom to go up to the Temple in Jerusalem to give thanks for the safe arrival of a new baby. Simon and Anna were old people who spent most of their time there meeting people and praying. Simon was convinced that he would see the Messiah before he died and so he did.
When Mary and Joseph brought baby Jesus to the Temple to give thanks Simon saw them and knew this was the Messiah, he hadn't been expecting a baby but this was the one he had been waiting for. Now everything he needed was done and his time was up and he was ready to go.
We can't be as sure of our time as Simon was so we need to be ready at any time.