The Istari (the five wizards) were special cases. We don't know many details, but JRRT did say enough to make it clear that there were differences between them and the other Maiar who visited Middle-earth.
Ordinarily, all of the Ainur (Maiar and Valar both) have bodies (or not) at will:
Now the Valar took to themselves shape and hue; and because they were drawn into the World by love of the Children of Iluvatar, for whom they hoped, they took shape after that manner which they had beheld in the Vision of Iluvatar, save only in majesty and splendour.
Moreover their shape comes of their knowledge of the visible World, rather than of the World itself; and they need it not, save only as we use raiment, and yet we may be naked and suffer no loss of our being.
Therefore the Valar may walk, if they will, unclad, and then even the Eldar cannot clearly perceive them, though they be present. But when they desire to clothe themselves the Valar take upon them forms some as of male and some as of female; for that difference of temper they had even from their beginning, and it is but bodied forth in the choice of each, not made by the choice, even as with us male and female may be shown by the raiment but is not made thereby. But the shapes wherein the Great Ones array themselves are not at all times like to the shapes of the kings and queens of the Children of Iluvatar; for at times they may clothe themselves in their own thought, made visible in forms of majesty and dread.
This was intrinsic to their nature, but it could be lost in two ways. First, by evil. Evil acts diminish the being of the evildoer, and with the Ainur, one consequence is a loss of the ability walk "unclad" or to choose the body in which they will be clad.
Sauron was indeed caught in the wreck of Númenor, so that the bodily form in which he long had walked perished; but he fled back to Middle-earth, a spirit of hatred borne upon the dark wind. He was unable ever again to assume a form that seemed fair to men, but became black and hideous, and his power thereafter was through terror alone.
Secondly, the Istari, who were Maiar, accepted special limitations on their mission to the people of Middle-earth. They were also bound to their bodies and could not change them. They accepted as part of their mission that they were to guide and inspire Elves and Men, but not to control them. These limitations were real, and their intrinsic powers were diminished. (Presumably to be restored after they successfully completed their missions, though Tolkien never said that.)
Additionally, they lost most of their memories of Valinor and of the Music of the Ainur, making them hardly more powerful than Elves and Men. Other than in what limited memories were left to them, they were like the most powerful of the Elves.
it was said among the Elves that they were messengers sent by the Lords of the West to contest the power of Sauron, if he should arise again, and to move Elves and Men and all living things of good will to valiant deeds. In the likeness of Men they appeared, old but vigorous, and they changed little with the years, and aged but slowly, though great cares lay on them; great wisdom they had, and many powers of mind and hand.
Olórin I was in my youth in the West that is forgotten
'Yes, I am white now,' said Gandalf. 'Indeed I am Saruman, one might almost say, Saruman as he should have been. But come now, tell me of yourselves! I have passed through fire and deep water, since we parted. I have forgotten much that I thought I knew, and learned again much that I had forgotten.
Other Maiar who visited Middle-earth (e.g., Melian, the many minions of Morgoth) retained their native powers when embodied except to the extent that they spent them in evil.
Both Sauron and Saruman diminished themselves through evil. Sauron lost the ability to appear in forms other than as a hideous Black Lord. Saruman, after being stripped of his powers by Gandalf the White, was nothing but the old man that his body had always been.
When they were killed, the same thing happened: What was left of their self-maimed spirits rose like smoke, and a wind from the West dispersed it. We don't know what, if anything, remained of Saruman. Sauron was left as nothing more than a spirit of malice unable to take bodily form ever again.
And as the Captains gazed south to the Land of Mordor, it seemed to them that, black against the pall of cloud, there rose a huge shape of shadow, impenetrable, lightning-crowned, filling all the sky. Enormous it reared above the world, and stretched out towards them a vast threatening hand, terrible but impotent: for even as it leaned over them, a great wind took it, and it was all blown away, and passed;
about the body of Saruman a grey mist gathered, and rising slowly to a great height like smoke from a fire, as a pale shrouded figure it loomed over the Hill. For a moment it wavered, looking to the West; but out of the West came a cold wind, and it bent away, and with a sigh dissolved into nothing.
In the end, the Valar rejected both Saruman and Sauron. We know that Sauron's maimed spirit remained -- impotent -- in Middle-earth. We don't know what happened to what was left of Saruman after his body was killed and the Valar rejected him: Tolkien never said. (My own guess is that his fate was the same as Sauron's, but that's only a guess.)