Sherlock was convinced that the Abominable bride had somehow managed to successfully fake her death in order to kill her husband and never be convicted of the murder. He then assumed that she stuck around in order to commit more murders and go on with her life in secret, so attempted to catch her in the act.
He successfully and quickly deduced that other murders that took place around the city with the same modus operandi were done by copycat killers, but considering the amount of buildup around the case that he was investigating (seeing the bride in the garden etc.), he assumed that the original culprit was to return to commit this murder as well, for an as yet unknown reason.
He later discovers that the original bride never pulled off this murder, but instead it was the wife assisted by a secret society of women attempting to win more rights.
When he realizes that the bride is in fact dead, it was quite simple to deduce how she committed the first murder, how she initially faked her death and then how he came to examine the body up close in the morgue.
The body he examined was in fact her body, it was initially a decoy that was replaced after she committed the murder before anyone could come and investigate it properly, in order to be able to withstand the intense scrutiny that would surely come after people witnessed her "resurrection".
The only thing that Sherlock couldn't figure out was how she had died and then come back. But considering she never came back, he realized the possibility that Moriarty had not come back either.
The only Moriarty that he was battling was the one inside his own mind. The rest was simply rumor and shadow created by what we can assume is a secret society/network of sleeper agents that Moriarty had set up, in much the same way it was done by the bride and the secret society of women who had assisted her.
So at the end when he says something along the lines of
Moriarty is not alive. But he's back.
he's likely referring to the fact that plans that Moriarty had put into action before his death were simply now surfacing, so his work is still around even though he is not.