A lot of heroes died. Some of them Thanos scattered in time and space. When the head of Iron Man was brought to Thanos, he decided it was time to end it, and with a little effort of will he cleared the battlefield. Even the strongest cosmic creatures who came to the help lost to Titan. It was all over.
The trouble for Thanos came from where he did not expect it at all. From a living corpse that he himself created from his own granddaughter - Nebula. While Thanos rejoiced in the victory, Nebula was able to get close and steal the gauntlet with infinity stones.
Wearing a glove, she immediately returned her original body and destroyed Thanos. Then she brought back to life all living beings who had died because of the power of stones.
But Nebula did not take into consideration that she also resurrected Thanos, who teamed up with the heroes in the battle against her, since the years of imprisonment and tortures by Thanos greatly destroyed her mental state and she could not cope with the power of the stones.
Together, the heroes managed to pick up the glove, which Adam immediately took possession of. To prove that he would use it wisely and for the good, he had to open his soul to some of the heroes. This was enough for him to be believed and the glove remained with him.
Thanos fakes his own suicide and everyone believes in his death. Except for Adam, who knows that the Titan just teleported. In the finale , Adam visits Thanos, and he is even glad that the glove was taken from him. Thanos hints to Adam that in every his plan there is a gap for his defeat, perhaps deep inside Thanos did not even want to win, he just wanted to be loved.