The Tesseract has been a key part of the Marvel Cinematic Universe (MCU) since Captain America: The First Avenger. As one of the six Infinity Stones, the Tesseract, aka the Space Stone, is one of the most powerful objects in the MCU, and though it only shows up briefly in Thor: Ragnarok, it's importance is not to be missed. Exactly what happened to the tesseract in Thor: Ragnarok is unclear, but it's clear that who has the Tesseract will be a key plot point in the upcoming Avengers: Infinity War.
Major spoilers ahead. The last time we saw the Tesseract, Thor was taking it to Asgard at the end of The Avengers, where he placed it in Odin's vault for safekeeping. Unlike the Infinity Gauntlet in the vault (deemed "fake" by Hela in Ragnarok), the Tesseract is very real — and crucial to Thanos' plans. At the end of Ragnarok, Loki is seen walking past the Tesseract while on his way to restore Surtur's power using the Eternal Flame so that the fire demon can defeat Hela. It's a brief moment, but Loki's admiring glance is no accident. After all, the Tesseract was crucial to Loki's evil plan to take over Earth in Avengers. He's been in possession of its power before, so it's not surprising to think he'd want it again. Besides, the only other option for the Tesseract is that it was blown up in Asgard and is now floating around in space. So, it's pretty safe to say that Loki has it. But what would Loki do with the Tesseract? Well, probably nothing good.
Assuming Loki took the Tesseract, it's quite possible he used some of its power to escape Asgard before Hela and Surtur destroyed it. His miraculous survival went unexplained in Ragnarok, which should raise suspicion. However, the Tesseract's powers are strange and somewhat uncontrollable, so it's just as likely that Loki used his wits and his own magic to escape death once more. So if he didn't take it because it was crucial to his own survival, why did he?
Loki may not be able to deny his love for his brother, but that doesn't mean his allegiances have magically changed. Loki's true loyalty only lies with one person: himself. This point is only emphasized by the fact that Loki fails to mention the Tesseract to Thor at the end of the film. It's possible that Loki wants to keep the Tesseract for himself. However, the leaked trailer to Avengers: Infinity War hints at a more troubling scenario.
In the San Diego Comic Con trailer for Avengers: Infinity War, Loki is seen kneeling amid piles of rubble, raising his arms up as if in praise or surrender, the Tesseract held up in front of him. It certainly looks like he's giving the Tesseract to Thanos, in fact that was most of the Internet's conclusion (see sites like Cosmic Book News and Movie Pilot). Let us assume for a moment that Loki is, indeed, giving the Tesseract over to Thanos, that doesn't necessarily mean he's crossed over to the dark side.
Towards the end of Thor: Ragnarok, Loki made it clear that, while he always looks out for himself, he also cares deeply about his brother. Not only does he not want Thor to die, he also doesn't want to disrupt the status quo to the point where he would have no power. He wants something to rule over. Thanos, on the other hand, seems more inclined to destroy whatever comes his way. Maybe Loki will hand over the Tesseract not because he wants to follow Thanos, but because he wants to stay alive. He can always switch sides later on. (If anyone is going to double cross Thanos, it's Loki.)
The bottom line is this: at the end of Thor: Ragnarok, it's pretty obvious that Loki has the Tesseract, and in the Infinity War trailer, it looks like he's giving it to Thanos. But if there's one thing we know about Loki it's that we can't trust what we see. It's a safe bet there's more to Loki and his relationship with the Tesseract going forward than meets the eye.