According to the legend, when Lucas began writing the story it got too big for one movie, so he decided to split it up. Shortly after releasing the first film, Lucas claimed he already had an idea of what all nine parts of the saga would be about.
"Bullshit. They'll all be about stupid, pointless, petty bullshit."
But Actually ...
Obviously there have been only six films (Lucas now says there were always supposed to be just six). But the truth is, when he released the first film he had no idea it was anything other than a stand-alone movie. The studio greenlit only the one film, and they had their doubts about making their money back. Lucas thus had to write it assuming he'd never get a chance to add to the story.
Most fans don't realize that the famous "Episode IV" isn't anywhere in the original opening crawl -- it was only added to later prints.
The original Star Wars started production under the name Adventures of Luke Starkiller, as taken from the Journal of the Whills, Saga I: The Star Wars, later shortened to just the last two words. The idea of numbering the episodes came up with the second film ... which was originally announced as Star Wars II.
"Star Wars II: Electric Boogaloo, thank you very much."