The flag of Vatican City is square, which almost no national flag is, and it puts the two symbols of papal authority (the keys and the tiara) on the traditional papal colors.
From the Papal States to the Lateran Treaty
The flag was adopted on June 7, 1929, after the Lateran Treaty with Italy recognized Vatican City as an independent state. It closed a long stretch during which the papacy had no territory of its own.
The Papal States, which lasted from 754 until 1870, flew a series of flags carrying Catholic imagery. Yellow and white first appear together in 1808, taken from the pope's personal banner with its gold and silver keys, and the combination was used to tell papal soldiers apart from others after French occupiers changed the flags of the region. In 1870 the Kingdom of Italy annexed Rome and the temporal power of the Papal States ended. The 1929 treaty restored a sovereign, if very small, papal state, and the new flag went with it.
The keys and the tiara
Two vertical bands, gold at the hoist and white at the fly, carry the crossed keys of Saint Peter beneath the papal tiara. Gold is read as spiritual authority, white as purity and peace, and both look back to the emblem of the Papal States.
The gold and silver keys come from the Gospel of Matthew, where Christ gives Peter the keys to Heaven. They mark the pope's authority and his position as Peter's successor.
The tiara, or triregnum, refers to the three roles of the pope: Supreme Pontiff of the Universal Church, Patriarch of the West, and Bishop of Rome. No recent pope has worn one, but it remains a fixture of papal heraldry.
Where it is flown
The flag is used across Vatican City and is central to papal ceremony. It flies at the Vatican museums and institutions and at international events where the state is represented, with protocols covering its display during major Catholic feasts and state occasions. It often appears next to the flag of the Holy See, which carries much the same imagery.
Historical variants exist, including a blue-bordered version once used by the Papal Navy. The navy is long gone, but the flag survives in the record.
Outside the Vatican itself, the flag turns up in the hands of pilgrims. At events like World Youth Day it is carried alongside national flags by Catholic pilgrims.
A national flag with religious symbols
The design descends from the flags of the Papal States, which varied a great deal over the centuries but kept returning to the keys and the papal colors. Vertical bands are common enough, and several Latin American countries use a similar palette, but a national flag built around explicitly religious insignia is rare, and it is what sets the Vatican's apart.
References
[1] Vatican City State - Official Website. (vaticanstate.va)
[2] "Flags of the World: Vatican City." Flag Institute. (flaginstitute.org)
[3] Smith, Whitney. Flags through the Ages and Across the World. McGraw-Hill, 1975.