@pensonfam I can't begin to express the sorrow I feel for you and your wife. This happened to us almost 12 years ago now. She was scheduled for a c-section (breach) at 39 weeks. Wife went into labor 3 days before. We went to the hospital with so much excitement and hope in our hearts only to have the triage doc tell us there was no heartbeat.
It was devastating. There are no words anyone can say that will make things better. This shit doesn't "happen for a reason." It isn't some sad event that was "meant to be." You're not being tested. This was a tragedy. Plain and simple.
Some advice, if I may. Communicate with your partner. We started off well in this arena, but everybody processes grief in different ways, different timelines, and has different needs. Be open with your partner about what you need and what she needs. Right now, those two things may be the same, but in 6 months they may be very different.
The single most impactful piece of wisdom I received from a fellow father in this position is that your address book will change. It's not immediate, but you will see who will stick around with you through this and who won't. That's not a knock on those we lose along the way. Some people cannot handle a parent's grief and choose to distance themselves. Sometime people say well-intentioned but utterly offensive things while trying to help. The aftermath of that can cause a lot of rifts. Do the best you can.
Finally, give yourself grace. You are a grieving father. Your partner is grieving too. You will both make mistakes, say things you don't mean, do things that you wouldn't normally do. This happens. Give yourself time, and recognize when you need time down the road too. We don't magically pop back from this one day. My life is not what it was 12 years ago. One thing that helped us was a support group we found called Share Pregnancy & Infant Loss Support. They're in the US, so if you're not in the US, you may want to look to see if there is anything similar in your area. Their website still has many resources.
From one bereaved father to another, I can only wish for peace and love for you and your partner. You are loved. Your partner is loved. Your child is loved.
Feel free to DM anytime you need to talk, vent, ask questions, or anything else. There are a lot of resources out there for mothers, but very very few resources for fathers. I'd be honored to be a resource for you if you'd like.