Sherlock sorts people out; it's how he's learned to interact with the world - constructively, as mummy would say. He doesn't do it out of charity or compassion, although it might seem that way from certain angles. He just can't abide watching the idiots flail about helplessly. Or he can't stand watching someone get away with it… the transparent lies, the obvious criminal activity, the utter gall. Or sometimes they're simply puzzling - he loves puzzles. (And now that he's a consulting detective, he can pick and choose, find the really juicy ones.)
He'd noticed the pattern in early secondary school (about the same time he realized that keeping quiet was probably for the best, and then didn't, anyway, on principle). This is how it works: Sherlock is incredibly smart. Obviously. And being incredibly smart, he's able to sort things out for people who need things sorted - especially people who have something he needs, or who aren't entirely insufferable. And quite often the less dull ones become amenable to overlooking the most obvious of Sherlock's… well, he really can't bring himself to call them flaws or failings, because he grew up in a loving family and he's actually quite happy with who he is. His foibles. His irregularities.
And when everything is sorted, he watches them go, satisfied to see them get on with their lives - property recovered, crimes solved, convictions dropped, abusive husbands dead, puzzles unpuzzled... psychosomatic limps all cleared up. When they move on, he tastes a sweet little twinge below his sternum and smiles to himself.
He thinks it might be something like friendship, but he also knows that this really isn't his area, and it's not exactly something one asks about.
His favorites are the ones who stay around after he's finished, after everything's all sorted out; the ones who've taken a shine to him, for whatever reason. Probably some sort of cognitive defect at work, the halo effect or perhaps choice-supportive bias, but he finds it pleasant all the same. He doesn't really need the little favors, the free food, the break on rent, but they're nice little reminders that he can make friends, he can, in his own way. He fixes things up, that's what he has to offer, and some people are kind enough and smart enough to appreciate it, and he loves them for it... at least, he's fairly sure that's what the feeling is. He likes having a place somewhere, even if it just means free lunch or a nod from a bum. He can't be a normal friend - doesn't really want to - but he still has something to offer, in his own way.
Oh, don't try to make him a saint; he's a mean, selfish asshole, and there are very real reasons he can't be a normal friend. He maintains that they're all complete idiots - practically goldfish - compared to him. But still. Even a mean, selfish asshole can enjoy feeding the goldfish once in awhile.
Of course they talk about it (the vague they made up of everyone stuck in his orbit), talk about him and John, how he's giving John away, letting him go, like they thought Sherlock would try to hoard the good doctor away in his toybox. How stupid. He knows you can't make someone stay, and trying only makes them angry, and then there's no chance of scones, or free lunch... or the occasional phone call or visit. John had managed the latter about twice a month since returning from his Sex Holiday, which Sherlock considers a minor victory.
He had… missed John, in those two years away, and it was not at all like the little pangs he usually feels when he's finished with someone. Sherlock supposed he'd grown used to having him, thought things weren't quite ready to end just yet - but of course, he should have realized after two years the good doctor would find what he needed elsewhere. He wasn't that inept. There'd been a few wrinkles to smooth out - a wedding to plan and, unexpected, a comrade in arms to save; then the whole thing with Mary, making sure the bullet she put in his chest didn't ruin the new life John's built for himself, soothing John's ego, sorting out a reasonable narrative, sorting out Mary so John could be safe and happy and still… accessible. It was all much more than Sherlock was used to (and honestly, a bit of a culture shock after what he'd been up to recently). It took much longer than he was used to, too, and then there was the sweet ache that seemed stuck in his chest.
John wasn't all that different from from the other people he helped, not really. He was even tempered enough to put up with Sherlock, smart enough not to instinctively reject aberration - and he had a problem. In fact, he had several problems. Sherlock is very good at problems. It's just… usually, the solution only required Sherlock's intervention, not Sherlock himself.
John was a soldier at heart; he needed excitement, danger, purpose. Sherlock had it in spades.
John was a doctor at heart; he needed to care for someone. Sherlock knew from experience that he was an easy target.
More immediately, John needed a flat. Sherlock's new flat had an extra room, and Mrs. Hudson really couldn't afford to lower the rent quite that far, and isn't it lovely when two problems solve each other?
But more than anything, the doctor needed someone who understood him. And Sherlock… did. It was strange to meet someone who made sense to Sherlock, someone who wasn't Mycroft or mummy - and someone so universally likeable.
So the solution, therefore, was Sherlock himself - and in retrospect John was not like any other person he helped, not at all, and it made his sternum ache. But two years had passed, and John had sorted himself out better than Sherlock ever could, because John was brilliant (in his own simple way) and strong and sometimes boring, and so very likeable. He'd found the perfect solution: a petite, pretty, charming, relatively smart woman, a nurse, with a tantalizingly dark past, and if John could forgive Sherlock for almost killing Sherlock, he would certainly forgive Mary for almost killing Sherlock as well. Sherlock wasn't the solution he needed anymore. All that was left was to tidy up the loose ends, fix Mary's little blackmail problem (at the same time quenching the white hot burn of hate hate hate he felt for one Charles Augustus Magnussen) and John would be all sorted out.
When he saw that empty white room, he knew he was about to ruin himself and probably hurt John again. Would he go down in a shower of bullets from or rot in prison - or some other, hopefully more dignified end? Sherlock didn't want to die, God no, never. But it didn't matter, because this last act would sort everything out, finally, finally, and it wouldn't matter where Sherlock was because Sherlock won, and because John wouldn't need him anymore.
In the end, Mycroft gave him more than he could have wished for: the assignment was a death sentence six months out, true, but it would be easy enough to cover up. John wouldn't suffer his loss again; in the years to come, the doctor would smile at his pretty wife and lovely children (two on purpose, Sherlock predicted, and one accidental; names carefully selected from baby books, not inherited from family John resented and Mary didn't really have), remember Sherlock fondly, and daydream about the wild adventures the detective was off having without him. He'd never suspect a cold and unmarked grave. He'd never believe it, not after what Sherlock had done.
And then he's back. Five minutes out, heading off to face that last great adventure, and then right back to where he started. John is still on the tarmac, Mary beside him. And despite the pharmaceutical cocktail running through his veins, that spot below his sternum ached.
