To peg the exchange rate, you simply have to have a very wealthy organisation (like a government) buy/hold the currency whenever its price gets too low, and sell/spend the currency whenever its price gets too high.
That way, the supply and the demand are always balanced out.
It takes a *lot* of money to do this and the more the exchange rate wants to stray the more money it costs, but it does result in a greater ease of doing business which can therefore improve the economy of the nation – theoretically increasing tax revenue enough to pay for the cost of pegging the currency.
As others has suggested, the central bank has to set it as their target to keep a stable exchange rate.
Their primary tool is the interest rate. If interest rates are higher, people will want to invest in the country, to get a better return, which means they will buy UAE Dirham and sell dollars for example.
Secondarily, the central bank can trade the currency in the market. This is done for fine tuning the exchange rate, or to protect it under a lot of stress.
In a pegged exchange rate system, a country’s currency value is directly tied or “pegged” to the value of another major currency or a basket of currencies. This is usually done by the government or central bank. The aim is to maintain stability in international trade by preventing excessive fluctuations in currency values. The pegged rate is maintained through interventions in the foreign exchange market, where the central bank buys or sells its currency to keep its value in line with the chosen reference currency or basket. This system contrasts with a floating exchange rate, where currency values are determined by market forces.
The same way the gold standard worked over a century ago, just with the USD instead of gold. You can take a Dirham, hand it over to a UAE entity (Like the government or central bank), and they will give you a fixed amount of dollars in return.
There are plenty of issues that can come from this. But as long as the UAE has enough dollars, or resources they can easily exchange for dollars, they can do this.
Problems arise if the UAE can’t fulfil that promise. At which point their currency will be subject to market forces and the peg will be “broken”. Usually to the detriment of the UAE as people no longer trust in the value of their Dirham.
Latest Answers