In 1040 the empire was still relatively small, so some of this will apply to the 1050s and later...
Some of the Seljuks were still pagan shamanists, but most had converted to Islam. The ruling class were all Sunni Muslims. Sunni Islam at the time was further divided into various legal/theological schools of thought. The school you followed usually depended on where you were from, but the Seljuks generally referred the Hanafi school. The others were the Hanbali and Shafi’i schools, and there was also a Maliki school but they were mostly further west in Africa and Europe.
The other major branch of Islam was Islam Shi’ism, also with various offshoots, “Twelvers”, “Seveners” (based on how many legitimate imams there were supposed to have been), and further offshoots of those dvsons as well, such as the Ismaili Nizaris (better known as the “Assassins”). Shi’is mostly lived in Iraq, as well as certain cities like Aleppo in Syria. The Fatimid dynasty in Egypt was also Shi’i but that was outside of the Seljuk empire.
The Seljuks are often considered to be rapidly anti-Shi’i (and they were certainly the intractable enemies of the Fatimids), but Shi’is were welcome in the government, at least sometimes. Sunni’is and Shi’is rioted against each other sometimes in Baghdad and elsewhere, but the followers of the different Sunni schools also fought each other sometimes as well.
In addition to the main branches of Sunnis and Shi’is, there were also the more mystical, ascetic Sufis (although that was really an offshoot of Sunnism).
"Apart from Muslims, the Seljuk domains contained Christians, Jews, some dwindling numbers of Zoroastrians and, in a few areas, small numbers of related ancient Iranan faiths, such as the neo-Mazdakite Khuramdiniyya and the followers of Muqanna'." (Peacock, pg. 272)
Supposedly there were 40,000 Jews in Baghdad in the 12th century, although that might be an exaggeration. However many they were, they were led by an “Exilarch”, who, as far as the Seljuks and the Abbasid caliph were concerned, was the leader of all the Jews in the world, or at least the ones within their empire, from Yemen to China. (There were, of course, other communities outside the empire, in Egypt and Spain).
The major Christian communities were Melkites, Assyrians (also called Syriac, or Jacobites), and Nestorians. The Nestorians, or the “Church of the East”, were the majority of Christians in Central Asia (and in China as well) and some of the Seljuks were Nestorian Christians. There was a huge population of Christians in Iraq as well, especially in Baghdad where the Catholicos of the Church of the East lived. The Seljuks didn’t really know anything about the differences between the various kinds of Christians, so they assumed the Catholicos was the leader of all the Christians in the empire, although the Melkites and Assyrians had their own patriarchs in Antioch.
Other kinds of Christians in the empire were Georgian Orthodox, Armenian Orthodox, Maronites in Lebanon (when Lebanon was under Seljuk control), and Greek Orthodox. Anatolia especially had a lots of Greeks and Armenians, although they hadn't reached Anatolia yet in 1040. When they dd conquer it, it was mostly under the control of the Sultanate of Rum, an independent branch of the Seljuks.
So, in 1040, mostly Sunnis, Nestorian Christians, and shamanists, but as they expanded west in the 1050s, they gained all these other kinds of Muslims, Christians, Jews, and some small numbers of Zoroastrians.
Source:
A.C.S. Peacock, The Great Seljuk Empire (Edinburgh University Press, 2015)