Armenia has a long history of being home to ancient civilizations, and in the year 301 AC, it became the first state in the world to adopt Christianity as its official religion. Then, after the fall of the Roman Empire in 476 AC, the territory of Armenia fell gradually into Turkish and Russian spheres of influence. Despite lacking strong natural resources itself, Armenia is part of the Caucasus, a region situated between Russia and Iran, and between the Black Sea and Caspian Sea, that is rich in gas and oil outside the borders of Armenia.
During World War I, that opposed the Ottoman (Turkish) Empire against the Russian Empire in West Asia, Islamic Turkish authorities feared that Armenians would try to use the opportunity of the conflict to declare their own independence. As a response, around 1.5 million Armenians were exterminated on death marches and concentration camps in the Syrian Desert, in what is known as the Armenian Genocide. Turkey still denies it happened but is well documented and recognized by most western countries and Russia.
On the other hand, Azerbaijan, which is rich in oil and gas reserves, was incorporated into the Russian Empire in 1813 after a war that defeated the Ottoman Empire. Later on, just five months after the Russian Revolution of 1917, the Caucasus region (Armenia, Azerbaijan and Georgia) declared its independence as a whole country named Federal Democratic Republic of Transcaucasia, with its capital in Tbilisi, current Georgia.
However, this country lasted only one month, because Georgians, Azeris and Armenians did not agree who to support during the last stages of WW1, and instead decided to separate into three different republics. The Democratic Republic of Azerbaijan was the first country in the Muslim world to become secular, and the first among it to give women the right to vote, long before many countries in the West did it, like France in 1944.
The territorial problems with Armenia began shortly after the separation in 1918, and the Bolsheviks used the tensions to finally incorporate both republics into the USSR in 1922. In what can be now seen as a mistake, the Soviet leader Vladimir Lenin decided to establish in 1923 an autonomous territory called Nagorno-Karabakh, home to a 95 percent ethnically Armenian population, that was completely located inside the Azerbaijan Soviet Socialist Republic. This enclave remained relatively peaceful under Soviet rule, but in 1988, the ethnic Armenians of Nagorno-Karabakh began asking for the transfer of their territory to Armenia, something that was strongly rejected by both Azerbaijan and the Soviet government.
Ethnic antagonisms between Armenians, which are 97% Christians, and Azeris, 96% Muslims, grew over the status of Nagorno-Karabakh (called also Artsakh in the local language), and when Armenia and Azerbaijan became again independent after the collapse of the Soviet Union in 1991, a war for the control of this enclave erupted, resulting in more than 30,000 casualties. Armenia won the war in 1993, got the control of Nagorno-Karabakh and occupied 20 percent of Azerbaijan, mainly the corridor that linked the enclave with Armenia.
After that, periodic clashes between both countries left around one hundred soldiers and civilians being killed from 1994 until 2020, when a major war between the two countries erupted again after mutual accusations of not respecting the borders of ceasefires. In that year, more than a thousand soldiers and civilians were killed in a two-month war that ended in November 2020 with the victory of Azerbaijan, which took back most of the territories located between Nagorno-Karabakh and Armenia that it had lost in 1993.
Nevertheless, the war of 2020 could not resolve the conflict over the proper borderline between Armenia and Azerbaijan around some villages that were growing as enclaves in both countries. So in May 2021, Azerbaijan, which is mostly a one-party dictatorship led since 2003 by Ilham Aliyev, attacked Armenia, which has a more competitive multi-party system, leading to a full-scale war that has lasted until this day with intermittent ceasefires.
The reason why Azerbaijan is now escalating the conflict even further is because the dictator Aliyev feels entitled to do so, as the alliance system is currently favoring Azerbaijan:
Historically, Armenia and Russia had been close allies because of the Christian faith that binds both countries and Russia's rivalry with Turkey over the Caucasus region. But because Armenia has sought to become more liberal and Westernized in recent years, this has angered Moscow, resulting in a diminished Russian political support in the country's conflict with Azerbaijan.
Moreover, with the war in Ukraine stepping up constantly, Russia is too busy to open another front on its 'doorstep'. Instead, Russia has tried to be careful on its relations with Turkey, one of its most important partners at the moment, and keeping a mediating role in the Caucasus. Even more, Russia is now one of the biggest arms supplier of Azerbaijan, as is NATO member Turkey.
Another ally of Armenia is Iran, because the latter faces a threat of separatism from pro-Azeri groups, because there are more ethnic Azeris living in Iran than Azerbaijan itself. As a consequence, Armenia has received some logistical and military support from the Iranian government in the latest years to bypass the Turkish blockade into the Armenian economy. However, during the war, Iran and Russia have pursued a neutral official approach, short of condemning Azerbaijan's attacks and instead stressing the need for negotiations.
As for the United States, its position has been very ambivalent, because traditionally the White House has supported the "territorial integrity of Azerbaijan" in order to keep good relations with its NATO ally Turkey, and preserve the interests of western oil companies in the Caucasus. But the US Congress, strongly influenced by the Armenian lobby composed by the diaspora from the genocide in WW1, supports Armenia's irredentist ambitions in Nagorno-Karabakh.
Moreover, the US provides military aid to both countries. In 2018, Azerbaijan received $100 million in border assistance, while Armenia got $5 million for the same purpose and a similar amount for "humanitarian help" in Nagorno-Karabakh. This has been criticized by Azerbaijan for legitimizing the "illegal regime in the occupied lands, which damages the reputation of the US as a neutral mediator".
In short, both Russia and the US are quite neutral in the conflict, but because the country led by Aliyev has a strong support from Turkey and a UN resolution that backs the "territorial integrity of Azerbaijan", it feels encouraged to pursue its conflict with Armenia to expand its borders.
Finally, Armenia is too small, and too economically insignificant for world’s powers to step in and defend Armenia's territorial claims inside Azerbaijan, specially taking into account that its arguments for owning Nagorno-Karabakh are contrary to accepted principles of international law.