This is such a comfort. Much like the man born blind, Lazarus dies so they can see the glory of God. There is purpose in the pain. The text is very deliberate about telling us He loved Lazarus and his sisters. The delay was a loving delay.
As Jesus got closer to their pain he began to be troubled inside. The closer he got to their brokenness the closer he comes to breaking. The result is, "Behold how he loved him."
Mary and Martha had obviously talked about the role Jesus could have played in keeping Lazarus alive because the expressions are exactly the same.
Martha serves up a very clear statement about the person of Christ and about her confidence for Lazarus in the final resurrection. I would hope for that kind of confidence at every funeral I do.