Over the course of the last 17 years I've been doing rescue I've fostered over 100 (dogs and cats) - I think I figured it up once and it was like 170 or something. I love them all and there have been a few that I still think of longingly but as others have said, either they weren't a good fit here (didn't get along with a resident dog etc) or I didn't have the time or set up to be their best possible home. I look at like my job is to find them their perfect home. If that's not here, I'm not doing them any favors by keeping them even if it would have made me happy and I take a space from the next dog who needs me. We had a Pom last fall that I just adored. He went everywhere with me and I called him my "errand buddy" but he was very nervous about big dogs (well, other dogs in general) so even though he was super-attached to me, I didn't feel like keeping him was fair since other dogs are a big part of my life. he is now the spoiled only child of a young couple and seems to be doing well. I still miss his dance of joy though.
I have found that even when I'm strongly tempted, and even when our home is a good fit, that when the right adopter comes along I can let them go. Doing it enough times you can remind yourself of the last one you wanted to keep and the one before that and you remember that as much as it hurt at first, the pain dulled and then you were just happy they were happy.
One thing that's always hard is when they're super super bonded to you and you practically have to pry them off you to give them to the new owners. But it helps when you do this a lot and you get to see your former fosters later and see how attached they are to their new owners - and how sometimes, they only vaguely remember you. That's bittersweet, but ultimately a good thing, I think.