I'm going to give my interpretation as when I played the game. This may be right, it may be wrong, but it's what I thought until reading other interpretations.
Spoiler for Possible Game Spoilers?:
- Tomoya meets Nagisa on the hill. Story proceeds as normal with him and Nagisa. Nagisa dies, Ushio is born, Ushio dies
- Ushio ties her fate to the illusionary world using a light orb she gained from making Fuuko happy, thus saving herself and her father
- Ushio uses a 2nd light orb to send Tomoya back to the time that he first met Nagisa. He meets another girl, and develops the story until he finds another light orb
- After aquiring these light orbs, Ushio realizes this is the wrong light orb, and sends him back in time again to find the right one
- Eventually, Ushio gives up and lets him live his life. He winds up choosing Nagisa in this world. When he helps Sanae with her school, Ushio realizes it is really Akio who can save Nagisa
- Tomoya is sent back once more, and gains Akio's light orb. The illusionary world is destroyed, and Tomoya recovers at the birth scene. He uses the light to save Nagisa, breaking the curse
That is just how I interpreted it on my first playthrough. Though the explanations here make more sense. XD