it's usually one of 3 things for me
1. I watch/read an existing series and think I can do it better
2. I read a summary of an existing series, misunderstand it, and end up with a cool idea
3. I love an existing series and want to recreate what I love about it in my own stories.
You can also mix and match things or get a fun idea from "what if" scenarios. There's no real wrong way except for straight up copying a story and not changing things.