Well, first things first. You need to know the pills were actually placebos (they cut it from the movie, but it\'s in the special features).
Ok, hold on tight...
99% of the movie did happen, but then time rewinded itself (everyone kind of knows it happened, but it\'s more like a dream than a reality). Frank went back in time to show him how he would have affected everyone\'s life, had he lived. It\'s kind of a divine intervention type of thing. Ok, remember at the end of the movie when everyone\'s waking up on Oct. second and thinking how they need to change and be better people? None of that would have happened if Frank never went back in time. All that 99% of the movie was more like a lesson for everyone else. So Donnie goes through all that stuff, teaching everyone (Frank included) what\'ll happen if they keep doing the bad things they\'ve been doing. Kiddie porn dungeons, drinking and driving, etc. And the rest all just wake up with a feeling that thing\'ll be better (the asian girl, ect). So the second time the engine went through the artifact (those liquid chest portal things) Donnie was ready for it and he had the choice to \"walk within god\'s channel\" knowing he wasn\'t alone (Frank = God? -or- Frank = messanger of God?).
So, he didn\'t die just to save his woman, he died to change EVERYONE\'S lives for the better.
He didn\'t make the engine fall, that\'s just a random act of fate that was used as a tool to cheat everyone their lessons. He didn\'t create the \"time channel\" or atrifacts either, he\'s just gifted and given the ability to see them.
Hmmm... how\'d Frank go back in time to tell Donnie what to do? i\'m not 100% sure on that one, but based on all the God talks Donnie had with his shrink and the whole gist of the movie, i\'d guess God had something to do with it. Whatever this God is.