>>1028848To get the P route, you have to reach Sans with 0 exp. and do all of the optional scenes unlocked when you spare bosses.
To get the G route, you have to kill literally every possible enemy and boss from the start of the game up to Undyne.
N route is anything in between, but you're forced to see the N route ending once before you can complete the endings for the other 2 routes. If you complete the P route on your first playthrough, you'll get the option to go back and replay just the ending to get the P ending, as well as a hint about any optional content you left unfinished that's required for the P ending. In practical terms, since the game pushes you towards sparing enemies, there's almost no difference between an N and P playthrough aside from the ending. Most people who miss the P ending do so because they killed the first enemy they met in the tutorial area or killed the Toriel because they didn't know any better.
G route changes the game significantly. Towns are deserted because people are evacuating to escape you, shopkeepers are either terrified of you or just abandon their shop and let you take whatever you want. Undyne and Sans are both changed to be much more challenging fights, but on the flipside the rest of the game is basically just a corridor to those two bosses. All of the other bossfights are trivialized and you skip right past their subplots. It's a playthrough built around assuming you've already beaten the game once and seen all the story stuff, so you just walk through and kill everything to see those two new bosses. Ironically, outside of those 2 fights, the combat tends to actually be easier than the P route.