It was supposed to end with Ls death. But being a manga on Shonen Jump where the rule of it is "Friendship, Hard work and Victory" they didn't allow the writer to end it with baddies winning. So he was forced to add N and M who was both inferior to L. While I was hoping for Light dying at the end, I didn't want it to end with that guy (Jovanni?)s uber hacking skill, copying the entire book on one night.
I liked the ending sequence though.. Very emotional.