Created by a Munchkin farmer and animated by means of a disembodied spirit (although there are some difficulties with this explanation, as we'll see later on), the Scarecrow was freed by Dorothy two days after his creation, and accompanied her on her journey to the Emerald City. At the end of this adventure, he not only received his brains, but was also given the throne of the city itself. He's occasionally referred to as having been King of Oz, but The Land of Oz is pretty consistent in calling him merely King of the Emerald City. Of course, this was after the witches had divided the country among themselves, and I get the impression that both the Wizard and the Scarecrow were sort of figurehead rulers of all of Oz, but really only had power in the Emerald City itself. Anyway, once Ozma was restored to the throne, the Scarecrow left the city to live with his old friend and companion Nick Chopper, Tin Woodman and Emperor of the Winkies, and to serve as his treasurer. A few apocryphal sources suggest that he was eventually promoted to Ozma's own treasurer, but I don't believe this is stated in any of the Famous Forty. Regardless, he does appear to be living at least primarily in the Emerald City between Ozma and Emerald City, but this latter book introduces a new home of his own. It's a corn-cob-shaped tower-mansion in the Winkie Country, not too far from Nick's Tin Castle.
In later books, the Scarecrow is a member of Ozma's Royal Counsel, and Ruth Plumly Thompson's unfinished short story "The Enchanted Tree of Oz" (which was written in the twenties but takes place some time prior to that), he is identified as her Chief Counselor. He divides his time between his own mansion, the Emerald City, and the Tin Castle, as well as spending much of it in travel. He participates in many adventures, and after dethroning King Krewl of Jinxland in the book that bears his name, the citizens of that country try to make him their new ruler. He refuses, however, and they choose Princess Gloria instead. The Scarecrow's life as a ruler had not yet ended, however, as Royal Book sees him hailed as the reincarnated Emperor of the Silver Island, a country located deep underneath the farm where he was made. The explanation given to him by the Grand Chew Chew, the most important minister in the imperial court, is that Emperor Chang Wang Woe (yeah, you'll have to get used to these goofy faux-Chinese names if you read Royal Book) was turned into a crocus by a wizard in the employ of the Emperor's rival, the King of the Golden Islands. The crocus eventually grows into a beanstalk (don't ask me how THAT happened), and it is prophesied that the Emperor's life force would enter into the first person to touch the other end of the beanstalk, and that this person would return in another fifty years to save the island. This turns out to be the Scarecrow, which finally explains why he's alive. This explanation does seem a bit suspect, though. It had presumably only been around twenty years since the Scarecrow came to life, which would have meant that nobody, even the farmer who made the Scarecrow and farmed the land around the top of the beanstalk, had touched the enchanted plant in approximately thirty years. Regardless, the Scarecrow did rule on the Silver Island for a few days, saving the empire from an invasion and narrowly avoiding a plot to restore his old body. Upon leaving, he left the island in the hands of his favorite servant Happy Toko.
Once John R. Neill took over writing duties for the Oz books, the Scarecrow suddenly took on a new role, that of King of the Munchkins. I didn't read the Oz books in order, and when I saw the references to the Scarecrow as King in Neill's books, I figured he must have been given the position at some point in the Thompson books. But no, Thompson left an original character ruling the Munchkin Country, and Neill just made him the Munchkin monarch with no indication as to how or why it happened. Admittedly, there's a neat kind of symmetry in the Tin Woodman ruling the West and the Scarecrow the East, but since this position isn't mentioned in any of the books before or after Neill's, it was presumably either a mistake on Neill's part or a temporary position.
Pretty impressive résumé for a straw-stuffed man made to scare away crows, isn't it? In addition, the Scarecrow has the reputation of being the wisest man in Oz, as well as the most popular man in the country. Not too shabby, huh?
Pictured below: Scarecrows of stage and screen