With another dramatic fireworks display Sunday evening at the National Stadium here, the Beijing Olympics came to a dazzling close, ending two weeks of spectacular athletic performances during an Olympic competition. Unlike in the opening ceremony, with its orderly parade of countries and their athletes, the closing ceremony brought flag bearers congregating in the middle, and athletes filing in somewhat haphazardly and many dressed less formally. Beijing had staked everything on the Games, galvanizing the nation, spending billions to rebuild the ancient capital, erecting fantastic stadiums and producing the kind of opening and closing ceremonies that can only be created in China, with tens of thousands of performers dazzling a global television audience the vibrant displays of color and mass synchronization. The 29th Olympiad was supposed to be China's coming out party, a show of its rising economic and political power and its reemergence as a global power. And in many ways it was. But the Games also turned into a dramatic show of this country's athletic power, with China hauling in 51 gold medals, enough to top the gold medal tables and unseat the United States, which won 36.