The "story mountain" as mentioned above is certainly one way to look at it. Another way, which doesn't work for every story but works for a lot of them, is Joseph Cambpell's monomyth, more commonly known as The Hero's Journey. It is mainly applied to stories in which a hero goes on an adventure. It goes somewhat like this:
- Ordinary World: The world where the hero lives. Basically, their ordinary (or not-so-ordinary) life pre-adventure.
- Call To Adventure: Something happens to spur the hero to adventure. Often this is someone near to the hero being abducted by the villains, or the hero's hometown being destroyed by the villains. The hero may jump at the call, or they may refuse it (but don't expect the refusal to last for long).
- The Mentor: A mentor figure appears to aid the hero on their quest. May or may not be supernatural.
- First Threshold: The hero crosses over into the world of adventure. May include a Belly Of The Whale moment, a final separation between the hero's known world and self (so named for the Book Of Jonah where he gets swallowed by a whale and regurgitated in circumstances too complicated to go into here).
- Tests, Allies, and Enemies: Exactly what it sounds like. The hero endures tests, makes allies, and fights enemies. The main portion of the story is almost always here. The hero may meet someone who provides items that will help in the future, and conversely may be confronted with temptations to abandon their quest.
- Darkest Moment/Abyss: The hero will often fail in such a way that all seems lost, and they will be at their darkest moment. It is here that they must look into themselves and find a way to get back up. This may include encouragement from others. This, like the Belly Of The Whale, is a symbolic death and rebirth.
- Transformation: The hero is no longer the person they once were before the journey. Now, they are a new person entirely.
- Atonement: The hero confronts and is initiated by whatever holds the ultimate power in their life. The hero thus comes to understand everything they have endured, and atones with the power.
- Climax and Ultimate Boon: The hero overcomes the final challenge and achieves whatever they set out to do.
- Return: The hero returns back to their ordinary world- or chooses to stay in the new world instead. But either way, they do so a changed person, with new attained wisdom that they may use to help others.
Now, this is by no means definitive and has even been the subject of some criticism, and some stories may not have all the steps. And there are plenty of other story structures out there.
As for how the ideas for a story are developed, there is never a single answer- everyone gets their ideas differently.