Sauron is incredibly arrogant. This is the reason Frodo, Samwise, and Gollum were able to destroy the Ring - because Sauron never imagined that anyone could ever resist the Ring's corruptive effects, or that anyone would willingly choose to destroy it.
Gandalf says as much at the Council of Elrond:
"Into [Sauron's] heart the thought will not enter that any will refuse [the Ring], that having the Ring we may seek to destroy it. If we seek this, we shall put him out of reckoning."
- The Fellowship of the Ring, The Council of Elrond
Sauron's reaction when Frodo puts the Ring on inside of Mount Doom confirms Gandalf's prediction:
And far away, as Frodo put on the Ring and claimed it for his own, even in Sammath Naur the very heart of his realm, the Power in Barad-dûr was shaken, and the Tower trembled from its foundations to its proud and bitter crown. The Dark Lord was suddenly aware of him, and his Eye piercing all shadows looked across the plain to the door that he had made; and the magnitude of his own folly was revealed to him in a blinding flash, and all the devices of his enemies were at last laid bare. Then his wrath blazed in consuming flame, but his fear rose like a vast black smoke to choke him. For he knew his deadly peril and the thread upon which his doom now hung. From all his policies and webs of fear and treachery, from all his stratagems and wars his mind shook free; and throughout his realm a tremor ran, his slaves quailed, and his armies halted, and his captains suddenly steerless, bereft of will, wavered and despaired. For they were forgotten. The whole mind and purpose of the Power that wielded them was now bent with overwhelming force upon the Mountain.
- The Return of the King, Mount Doom
For the same reason - his immense, foolhardy pride and hubris - he never imagined that he would ever be separated from the Ring. It simply didn't occur to him.
Was it foolish of Sauron to put so much of his own power into something that he could lose? Perhaps, depending on your personal outlook. Was it necessary that he do so in order to achieve his goals? Probably. The following quotes should help to explain the issue.
Now Sauron's lust [for power] and pride increased, until he knew no bounds, and he desired to make himself master of all things in Middle-earth... He brooked no freedom nor any rivalry, and he named himself Lord of the Earth.
- The Silmarillion: Of the Rings of Power and the Third Age
And much of the strength and will of Sauron passed into that One Ring; for the power of the Elven-rings was very great, and that which should govern them must be a thing of surpassing potency...
- The Silmarillion: Of the Rings of Power and the Third Age
[Sauron] only needs the One; for he made that Ring himself, it is his, and he let a great part of his own former power pass into it, so that he could rule all the others.
- Gandalf, The Fellowship of the Ring
Sauron didn't make the Ring on a whim; there was a method to his madness. More than anything else, Sauron hated the Elves (and to a lesser extent, the Men of Númenor), and he desperately wanted to bring these enemies to heel. To achieve this goal, he misled the Elves into trusting him, and taught the Elven smiths how to make Rings of Power. He himself played a part in making the Nine Rings intended for Men and the Seven Rings intended for the Dwarves, but the Elves refused to let him interfere with the creation of the Three Rings of the Elves - which, as it was later seen, was a very clever move on the part of the Elves.
In secret, after the other Rings had been made, Sauron went to Mount Doom, and there, with the fires of Orodruin, he made the One Ring - the Ruling Ring. With this Ring, he could now control the Men, Elves, and Dwarves who wore the other Rings - or so he thought. Unfortunately for Sauron, as soon as he put his Ring on, the Elves became aware of it, and immediately realized what he had been planning. The One Ring allowed Sauron to know the thoughts of those who wore the other Rings, and this was part of his plan; what he hadn't anticipated was that the Elves who wore the Three Rings were likewise able to know Sauron's thoughts. Being wiser than Men and Dwarves, and because Sauron had not been present when the Three Rings were made (which apparently limited his ability to control the Three), the Elves who wore the Three Rings immediately took them off.
The Elves were furious at Sauron for tricking them, and thus began the War of the Elves and Sauron. Large swaths of Middle-earth were destroyed in the conflict, and when it ended, Sauron still held the One Ring, although the Elves now knew better than to trust him ever again.
Unfortunately, not everyone is as smart as the Elves, and Men in particular were only too willing to believe Sauron's lies. They, and the Dwarves, accepted Sauron's "gifts", with disastrous results. The Men who received the Nine were very quickly consumed by their Rings; the human tendency of lust for power made Men especially susceptible to corruption by the Rings. In almost no time at all, the human kings who wore the Nine became the Nazgûl - Ringwraiths, the slaves of Sauron.
The Dwarves, on the other hand, were not so vulnerable. Being stout and steadfast, with powerful wills, the Seven Rings simply made the Dwarves who wore them even more greedy than normal. Those who wore the Seven didn't fare very well, but they certainly weren't turned into Ringwraiths. In fact, Sauron was so unhappy with the Dwarves' resistance to the Seven Rings that he tried to get them back, presumably so he could redistribute them to Men.
As we all know, Sauron continued to cause trouble for Middle-earth for several thousand years, but was never quite able to realize his ambitions. He found his way to Númenor, convinced most of its inhabitants to worship Morgoth, and finally, he persuaded the king that, if he led an invasion of Aman (where the gods lived), he could obtain the gift of immortality for all mankind. As you might expect, invading what amounts to heaven is not a very good idea, and the invading army was destroyed by Eru Ilúvatar; Númenor itself was also destroyed, and only the few Númenoreans who had remained faithful to Eru Ilúvatar were spared. Sauron, too, managed to escape the cataclysm, but forever afterwards, he was incapable of taking a form that wasn't hideous and terrible in appearance.
He spent a long time recovering from his ordeal, and when he was strong enough, he made war on the Númenoreans who had survived the downfall of Númenor; these Númenoreans were now living in Gondor and Arnor. Sauron's reemergence surprised his enemies, but they quickly assembled themselves in preparation for war. The Elves, who the Númenoreans were friendly with, joined the cause, and so began the War of the Last Alliance.
Sauron's armies were utterly defeated by the end of the conflict, and Sauron himself was nearly destroyed once and for all. The Elven King Gil-galad and Elendil, the King of Gondor, defeated Sauron in personal combat, but were themselves killed in the process. Elendil's son, Isildur, took the shards of his father's sword and sliced the ring finger from Sauron's hand, and Sauron was thrown out of his physical form, totally defenseless. Elrond and Cirdan urged Isildur to destroy the Ring, but he couldn't bring himself to do so. Within two years, the Ring betrayed him, he was killed in an ambush, and the Ring was lost for hundreds of years.
Gollum found it, or rather, his friend Déagol found it, and Gollum immediately murdered him and stole the Ring. Eventually, the Ring abandoned Gollum, and was found by Bilbo. It passed on Frodo, who eventually played a part in its destruction.
The important thing is that, on one occasion after another, the Ring nearly allowed Sauron to rule the world. This is why he made it in the first place. Sauron with the Ring was far more powerful than Sauron without the Ring, as Tolkien explains in his letters:
The Ring was unbreakable by any smithcraft less than his own. It was indissoluble in any fire, save the undying subterranean fire where it was made – and that was unapproachable, in Mordor. Also so great was the Ring's power of lust, that anyone who used it became mastered by it; it was beyond the strength of any will (even [Sauron's] own) to injure it, cast it away, or neglect it. So he thought. It was in any case on his finger.
A moral of the whole (after the primary symbolism of the Ring, as the will to mere power, seeking to make itself objective by physical force and mechanism, and so also inevitably by lies) is the obvious one that without the high and noble the simple and vulgar is utterly mean; and without the simple and ordinary the noble and heroic is meaningless.
But to [make the Ring, Sauron] had been obliged to let a great part of his own inherent power (a frequent and very significant motive in myth and fairy-story) pass into the One Ring. While he wore it, his power on earth was actually enhanced. But even if he did not wear it, that power existed and was in 'rapport' with himself: he was not 'diminished'. Unless some other seized it and became possessed of it. If that happened, the new possessor could (if sufficiently strong and heroic by nature) challenge Sauron, become master of all that he had learned or done since the making of the One Ring, and so overthrow him and usurp his place. This was the essential weakness he had introduced into his situation in his effort (largely unsuccessful) to enslave the Elves, and in his desire to establish a control over the minds and wills of his servants.
- The Letters of J.R.R. Tolkien, #131
As we can see, the question of whether making the Ring was a good idea isn't as easy to answer as you might expect. From Sauron's perspective (before he lost the damned thing), it was the best idea anyone had ever had. It made him far more powerful, and it allowed him to control anyone who wore one of the Nine, or the Three - or, at least, it would have allowed him to control whoever wore the Three, if the Elves hadn't been smart enough to remove the Three before Sauron could take control of them. The Seven were a total failure - you just can't control Dwarves. The Three were a partial success, or would have been, but Elves are hard to fool. The Nine were an absolute triumph.
It is difficult to say more than that with any certainty. In hindsight, of course, the Ring was Sauron's undoing, and in this light, it was a terrible idea from the start. But we don't live in hindsight. Even a being as powerful as Sauron can't predict the future. With the information available to Sauron at the time, it probably seemed impossible that he would ever lose the Ring, or have to deal with the consequences of being separated from it. He might have realized that it could, theoretically, make him a bit more vulnerable, but even if he did realize this, the risk was wildly outweighed by the rewards - especially because his arrogance led him to believe that, regardless of how dangerous it would be for him to lose the Ring, that would simply never happen.
Once the Ring was made, Sauron never imagined that he might lose it; once lost, he never imagined that anyone who found it could resist its corruptive effects and refrain from using it; once found, he never imagined that anyone would choose to destroy it rather than claiming it as their own.
This might seem to suggest that Sauron was foolish all along, but I don't think that's the whole story - let's break that down piece by piece:
Once the Ring was made, Sauron never imagined that he might lose it: Yes, he eventually lost it, but it took a long time and a lot of effort to make that happen. He held on to the Ring for thousands of years, through at least 3 wars, the destruction of vast areas of Middle-earth, the total ruin of an entire continent (Númenor), and finally, he withstood a siege of several years, then came forth to give personal battle to his enemies. He killed most of the leadership of the opposing forces, including an unknown number of immortal Elves, before Isildur, the son of one of his victims, got lucky and chopped off his finger. Even then, with Sauron more or less dead, for lack of a better word, the Ring continued to do his will. It killed Isildur.
Once lost, Sauron never imagined that anyone found it could resist its corruptive effects and refrain from using it: In this, too, the Ring worked exactly as advertised. Isildur had been the first to hold the Ring after Sauron; he wore it in his unsuccessful attempt to flee the ambush. Gollum found it, and spent the next several centuries using it. Bilbo found it, and frequently used it for several decades. Frodo inherited it, and despite Gandalf's emphatic warnings not to use it, he did so anyway, many times. When Frodo shows it to Tom Bombadil, he immediately puts it on, although it has no effect on him. When Sam briefly carried the Ring, he, too, used it, despite also having heard Gandalf's warnings. As far as we know, literally everyone who has ever held the Ring has also used it at least once.
Once found, Sauron never imagined that anyone would choose to destroy it rather than claiming it as their own: Even here Sauron was right. Of course, the Ring was eventually destroyed, but remember how that came about. Frodo was supposed to toss the Ring into the lava. He didn't. He said "The Ring is MINE!", and put it on his finger. Left to his own devices, he presumably would have walked straight out of the mountain and smack into the arms of the Nazgûl. The only reason this didn't happen is Gollum. He wanted the Ring too much to let Frodo walk away with it, so he bit Frodo's finger off and steals the Ring. Whether you attribute what happened next to Gollum's clumsiness or divine intervention by Eru Ilúvatar, the net result is the same: both Gollum and the Ring wind up in the lava. But the important thing is this: No one, except perhaps Eru, chose to put the Ring in the lava. It got there by accident. No one could bring themselves to discard it, let alone destroy it forever
So you can take whatever answer you choose from this. It is a complex issue, and what you decide to believe is largely dependent upon your point of view.