It's how much it impacts you. Like your more likely to remember a nightmare than a fun dream. Plus your also in so much shock when you wake up from a nightmare.
If you want to remember your dreams keep replaying them in your mind from start to end. Then write them down somewhere.