Yzerman's mobility which had already lost a step for few years now was totally shot after his operation in 2002. It was honestly a huge surprise and a testament to his conditioning and drive that he even continued his career after a surgery that's done for old men lol
In 2003-2004 with the departure of Fedorov, Wings were ripe for Datsyuk and Zetterberg to really take over but they were still pretty green and so you saw a guy like Draper take on a bigger role and Yzerman's own role didn't diminish as much as you would think. There was a nice Matby • Draper • Yzerman line to start off that year. Yzerman was effectively a winger who took faceoffs from the 2002 Olympics anyway.
Wings went out and got Robert Lang at the trade deadline to try and replace Fedorov, but he almost immediately got hurt though and missed all but a handful of games at the end of the season.
2005-2006 though was much tougher initially for Yzerman. He didn't play elsewhere during the lockout. New coach in Babcock rather than Dave Lewis who was Yzerman's teammate and then coach since the eighties. League was much faster too, which was not suited to Yzerman's abilities. Datsyuk and Zetterberg had fully arrived too, Lang was still there as well.
So Yzerman had a much diminished role to start. As others veterans started to fall by the wayside and retire that year, Yzerman also apparently considered retirement midway through the season, but then Lang went down with injury again, and so there was a need for Yzerman again, and he must have finally adjusted enough to the new league and rules. Remember that it was Yzerman who blasted the new NHL almost instantly, saying "it's not hockey" because of the way the game was called for basically breathing on another player (he was absolutely right in retrospect as it's come to its teleological end lol... so soft now).
He played great to finish the season and going into the playoffs, still pretty slow comparatively but a bit faster than before, plus his usual linemates were Lang and Jason Williams who were also not the greatest skaters so it wasn't looking too bad.
Unfortunately he kept getting groin injuries that last year and so despite finishing strong and by the playoffs end making it an open question if he'd return rather than a foregone conclusion he wouldn't, he ended up retiring.
Obviously Yzerman had a blank check to play however long he wanted on the Wings though he probably could have played another year or two legitimately but it also looked like he couldn't get those groin issues sorted out and didn't like the way the new NHL was going anyway.