How does the dagger work in Prince of Persia? If the holder goes to the past to change things what becomes of that time/world/characters which went through that time? Is it illusion? If it was illusion, then everything becomes illusions for everyone (since the holder can be anyone) which is impossible.
Short answer: It's not an illusion, it's an alternate timeline/reality
The dagger takes the user back in time. Basically, this means that the moment the user reaches the desired temporal point in the past, an alternate reality is generated. This is evident in the ending of the film, as well as the first game. The Prince still remembers the events of the previous timeline, but from others' point of view, that version of reality never happened. For them, the current one, is the only reality.
Prince Dastan rewinds the timeline so that Nizam's plan won't succeed. So basically, that timeline ceased to exist the moment the Prince went back. The alternate timeline doesn't get created at the point where he rewinds time, but at the point in the past where he "reaches".
So basically, everything that happens from the point that dastan gets the dagger up to Nizam unleashing the sand was replaced by the new timeline. Imagine that Dastan getting the dagger is the starting point. There are 2 timelines here. The original timeline was that Nizam kills the king, blames Dastan, kills dastan's brother, and unleashes the sands. But this timeline gets erased from existence the moment dastan arrives back in time, and exposes Nizam to be a traitor, thus avoiding all that happened in the original timeline.
For a better understanding of how alternate timelines work, you could refer to Back to the Future, or at your own risk ;) :P , Doctor Who (where such alternate timelines are abundant.)
The Sands of Time it (or them)selves cause ripples in the original timeline (as evidentiary at the point the Hourglass gets pierced) thus creating numerous different timelines for all of those close in the near vicinity of the Hourglass (though only Dastan remembers the previous timeline since he pressed the gem on the Dagger while it pierced the Hourglass thus unleashing the full power of the Sands).
The Sands, upon piercing the Hourglass, created some sort of temporal wave,a ripple if you like, which wiped the original timeline clean and returned everyone to the point the Persians led by Dastan achieved their latest victory but before Dastan himself revealed the traitor to be his uncle. So, basically, the Sands are the force that causes ripples in time thus creating alternate, or separate, timelines not only for the one using them but for all of those close to user (both personally and spacially) but they only allow the one using their powers to remember the original timeline (kinda like flashbacks of the old timeline but in the new,alternative timeline).
Hope I explained the way the Sands work. :)
This isn't exactly from the movie, but it does give you a good bit of information on it:
The Dagger of Time is an artifact linked to the Sands of Time. It enables the wielder to reverse, stop, slow, and use various Sand Powers, as well as protect them from changes in the timeline or alteration by the Sands.
It apparently works by placing sand within the dagger and pressing a small dial of some sorts at the end of the dagger.
The Sands of Time are a force, capable of controlling time itself. There are four objects related to them: the Hourglass of Time, which contains the Sands, the Dagger of Time, which unleashes them from the Hourglass, the Medallion of Time and the Staff of Time. The Sands of Time and these objects were created by Kaileena, the Empress of Time.
Hope it helped.