Memes aside, Hamilton didn't go to Ferrari because he believes he will win. He saw what Mercedes was doing and he realized that he can't get a win there, no titles, so he might as well go race for a few years as the most known brand all around, Ferrari is THE racing team, in all over the world at all kinds of races.
And now, he is just having fun, doesn't even care that much, care enough that he wants to give his all, but he is not expecting a title. He knows his title times are gone, so he just focuses on being happier and just be a Ferrari guy. So there is no way he would go back to Mercedes, there isn't anything that makes sense for him to go there. With that being the case, I am sure that we are going to see him stay there, and Max will be at Mercedes instead.
But Ferrari is certainly the best place for a goat like Hamilton to end his career. It's like closing a page in a book with gold ink, since Ferrari is a prestigious team in F1. Even if he doesn't win the title, even if his performance fluctuates, people won't blame him too much, because they already know the Hamilton era is over, and Hamilton doesn't need to prove anything. For now, people only see him competing with young talents - as for whether he can win the title, let time tell.