Avengers: Infinity War - Predicting The Entire Plot In 20 Steps
17. Loki Makes A Choice (But Doesn't Die)
Having seen his brother "die", Loki will be offered a choice by Thanos, who he has already wronged once by his failure to conquer Earth (thus making Thanos' conquest for the Stones easier in the long-run) - either die alongside him or join him. Presumably, Loki's self-preservation instinct kicks in, he presents Thanos with the Tesseract as a peace-offering to save his own skin, which the Titan destroys to get his hands on the Space Stone within.
Now, popular thinking diverges at this point as there are two very clear options for what could happen to Loki. He could either be killed off by Thanos as punishment for his failure and as a means to "teach" the Asgardians a lesson (which would indeed fit), or he could join Thanos again as an ally (albeit one under duress).
It's more likely - at this stage - that Loki will take the place of Mephisto who was Thanos' advisor in the Infinity Gauntlet comics (before eventually turning on him). The God Of Mischief is, after all, unfailingly committed to his own survival and aligning with Thanos would fit that. Sure, he might well then follow Mephisto's lead and betray him at a crucial moment (in Avengers 4 probably), but initially he'll appear to be one of his expanded Black Order.