The modern state of Tajikistan mainly encompasses the more mountainous part of Sogdia, an ancient division of Central Asia that contains some of the highest mountains in the world. Indeed, the Pamirs, the main mountain range of the country, is the Ur-Example for the phrase "Roof of the World". As you can guess, few people are willing to take the risk of living in untamed mountains, both in the past or present, which is why most of the interesting things happened in the southwestern lowlands and a piece of the very fertile Fergana valley located in the northern panhandle. Those who do choose to live in the mountains have to make do with pastoral nomadism and isolation, so they inherited their ancestors' culture more faithfully compared to the lowland peoples.
Most of the population speak a variety of Persian dubbed as Tajik. It is also spoken in Uzbekistan; Samarkand, the country's second largest city, is mostly Tajik-speaking. The naming came as a result of politics dating back to the Soviet era, as the authorities wanted to distance the Persians who lived in the Union from those who lived elsewhere. The Soviets were also the reason why Tajiks write with the Cyrillic script, instead of Arabic. Tajiki Persian have a different set of vowels compared to Iranian Persian, but they are just as innovative compared to Early New Persian (if you want conservative, look for Afghani Persian/Dari). The most obvious characteristic of Tajik is that they further mangled Early New Persian long /a:/ into the open-mid vowel /ɔ/, whereas other varieties still pronounce it as the open vowel /ɒ/. It's enough to warrant transcription into "o" instead "a", hence why it's "obi" instead of Iran and Afghanistan's "abi" (blue), "jahon" instead of "jahan" (world), and "Forsi" instead of "Farsi" (Persian). The current president's name, Imomali/Emomali Rahmon, is "Emamali Rahman" in Iranian.
The Zoroastrian holy book Avesta lists Sogdia as the second of the sixteen lands created by Ahura Mazda for the Iranian peoples. Though it has been mentioned since the 6th century BCE, no established state existed in Sogdia until the Achaemenids under Cyrus the Great invaded Central Asia. Alexander the Great's Asian campaign turned the region as part of the Greek Macedonian, then Seleucid empires before native control returned with the Kushans and a little-understood hodgepodge of nomadic and pastoralist tribes and peoples known as the Hephthalites.
In the 8th century CE, the Umayyad caliphate under Al-Walid invaded Sogdia and converted the local population to Islam. Conquest was not immediate, however, as a tug-of-war ensued between the Umayyads and the Turkic Turgesh confederation, who had made their move against Central Asia a few centuries earlier, ending with the caliphate's victory. Around this time, Persian settlers moved to Sogdia and Bactria (northern Afghanistan) and slowly but surely the locals abandoned their native tongues in favor of the immigrants' language. The new population was referred by the Turks, somewhat pejoratively, as "Tajiks".
Sogdia broke free of the Arabs' control a mere century after their conquest, alongside the rest of the Iranian world. The Samanid empire emerged as the most significant Persianate polity after independence, but it wasn't long until the Turks, now also Muslims, reestablished control with the Ghaznavids, the Seljuks, and the Khwarezmians, although native control did exist (the formerly Buddhist Ghurids being a major example). In the 13th century, the Mongols' world invasions hit Sogdia hard, but rebuilding commenced quickly, helped by the fact that it was spared from a similar invasion by the Timurids in the following century. After Timur's empire fractured, control was taken by the Uzbeks, who ruled the territory as part of the Khanates of Bukhara and Kokand.
The territory was caught into Tsarist Russia's expansion in the late 1800s, with light resistance. The northern part was directly controlled as part of Samarkand, Fergana, and Semirechie Oblasts, but the Russians allowed Bukhara, which included the present capital of Dushanbe, some degree of self-rule. During the Russian Revolution, Bukhara became a communist state until it was subsumed to what would be the Soviet Union. In 1924, the Tajik ASSR, later promoted to an SSR, came to being, which finalized the modern borders of the country. Dushanbe was for a time, called Stalinabad, in honor of Joseph Stalin. It seen its period of repression.
In 1991, the Soviet Union fell, and Tajikistan declared independence. It was soon however, under a state of civil war between secularist and Islamic factions until 1997. Being the poorest ex-Soviet republic did not help things either.
The current president is Emomali Rahmon, formerly Emomali Rakhmonov. He changed his surname to reduce Russian influence in Tajik culture. He also once considered reviving the Tajik Perso-Arabic alphabet. However, it was scrapped.
Tajikistan is also rather notorious for being a Muslim-majority country that cracks down on Islamic expression hard. The administration has banned long beards, Arabic-sounding names and the only Islamist party in the country, discouraged women from wearing headscarves and regulates religious practices and studies very closely - unofficial Islamic teachings can get you jail time. Any form of Islam not approved by the government is banned under the blanket of "Wahhabism", even if it doesn't necessarily fit the actual definition. Though such policies wouldn't be out of place like in Albania under Enver Hoxha or any other Muslim-majority Soviet regime, Rahmon has repeatedly stressed that he is a Muslim himself and has enforced secularism in order to curb religious extremism in his country.
The Tajik flag