Good question and I'm sure it's different for everyone. There is no right or wrong answer.
When my dog Bandit died I was crushed. He was a rescue, a mutt and just about the best dog anyone could ask for. His only vice was that he hated riding in cars so he couldn't go out and enjoy other places with us. He developed a tumor that nearly completely filled his bladder. It was only four days since he started showing any signs until he passed. Though it was nearly 3 years ago I still get choked up if I talk about it. He was a gentle giant and everyone in the neighborhood loved him. I still miss him.
When he died it left a huge hole. We're pet people. Our pets are all over the house/yard with us and we constantly interact so it all seemed so quiet. That's the good thing about critters though. There are plenty out there needing homes and if you lose one you can always find another.
I only lasted a month.
Enter Murphy, the Soft Coated Wheaten Terrier.
I admit that I wasn't instantly in love with Murphy as soon as he arrived, but I was happy he was here and I was very busy raising a new young puppy. Pups are a lot of work and a great distraction. Well you can't put that much effort into someone without developing the strong emotions and now he and I are very close. He follows me everywhere and goes everywhere he can with me in the car.
He's no Bandit but then Bandit was no Murphy either. Both awesome just different.
So the shorter answer is that a new pet can help ease the mourning of the old pet because the new one keeps you busy and distracted. It's not like losing a loved one (human) where you can't rush in and replace as necessary. Obviously the feelings for the new one will come as you spend time together and care for it. The new pet doesn't know the motivation, only enjoying the attention and care. Before long you will be happy again and have only the happiest thoughts for the pet you lost.