I think you respond with ‘congratulations’ and a polite comment.
I thought I couldn’t have another and was almost resigned to having one, when the fertility issues were unexpectedly resolved. But those years of TTC baby no.2 (upsetting and painful as they were) didn’t stop me congratulating friends on having their 2nd or 3rd child, I still enjoyed seeing baby photos and got excited for friends when they announced pregnancies. My friends knew we were TTC and close friends knew why it wasn’t happening, but I’m glad they didn’t cut me out of the important events in their lives like the birth of a child!
I think you need to separate your sadness from their joy, and try to be happy for them.
So many people can’t have any children, or have repeated losses, or are going through multiple IVF attempts, or have secondary infertility. They still hear of pregnancies and births, see photos, meet the children of family and friends. Nobody would think bad of them if they asked not to see baby photos or be included in celebrations, especially if they were still coming to terms with it or feeling raw pain. But if they wanted to avoid other people’s children (or second children) altogether, forever, never meeting or acknowledging the child, I’m not sure how they could stay within the social circle long term.
In our group of friends most of us have one or two, some have no children (by choice or due to infertility), I can only think of 2 families with 3+ children. Having one seems to be the average amongst our group, though having an age gap of 5+ years isn’t uncommon either.