In some ways, Ukraine has already won; Putin intended to capture Kyiv in three days and completely failed to do that. He turned to some minor territory gain, but that's also going very poorly. Russia's winter campaign is almost a complete failure, with tens of thousands of lives lost for very minor gains.
Ukraine is smaller than Russia, but by no means a small country. Ukraine has 40 million people and is far more motivated to fight than Russia is. Russians really have nothing to win here; it's just about Putin's pride. Meanwhile Ukrainians are fighting for their lives, their country, and the future of their children. These are powerful motivators, and go a long way towards explaining Ukraine's unwavering morale in the face of overwhelming odds.
Ukraine also fights much smarter. Russia uses very primitive tactics: use massive artillery to flatten entire cities, move infantry in, and if they get killed, flatten the place with artillery again. And then they ran low on artillery ammunition, not to mention that many of their barrels have been so overused they can't shoot straight anymore, so now they've resorted to human wave attacks. Ukrainian defenders of Bakhmut have described wave after wave of Russian attackers crawling over the dead bodies of their dead comrades only to get gunned down too. There's no sophistication at all, and coordination is often poor.
Meanwhile Ukraine with its more limited resources executes very smart attacks. Most of the time they target Russian supply lines to make it harder for Russia to fight. But sometimes they've undermined Russian positions so much that they can suddenly grab an enormous swath of territory, like they did east of Kharkiv and west of Kherson.
I frankly don't see how Ukraine can lose this. In some ways they have already won. Although of course it really depends on how you define victory and loss here; both sides have lost a lot, and any end result where Putin is in a position where he can try again later, means that the war for Ukraine is not really over.