The Quran says that whoever rejects Allah after having believed, except one who is forced while his heart remains secure in faith, is not blamed. Commentators such as Ibn Kathir and al-Qurtubi report that this verse was revealed about Ammar ibn Yasir, an early Muslim who was tortured in Mecca until he said words of disbelief while his heart stayed firm. Another verse tells of a believing man of Pharaoh's court who hid his faith while he tried to save Moses, peace be upon him, from being killed, and a third allows believers to protect themselves against real danger. This is what taqiyya, from a root meaning to guard oneself, refers to: concealing one's belief, or saying what one must, when life is truly threatened. It is a permission and not a duty.
The claim that taqiyya lets Muslims lie to non-Muslims to advance Islam is not what the sources teach. The Prophet ﷺ said that truthfulness leads to righteousness and righteousness leads to Paradise, while lying leads to wickedness and wickedness leads to the Fire, and that a man keeps lying until he is written before Allah as a liar. The Quran orders Muslims to fulfil their covenants and keep their word. Scholars do discuss narrow exceptions, such as saying good words to reconcile two people, and war, where the Prophet ﷺ said that war is deception. Scholars take that to mean stratagems and concealment against an enemy who is fighting, not breaking treaties or lying in the daily dealings of peaceful life.
Taqiyya is also discussed differently in Sunni and Shia scholarship. Sunni scholars accept the principle in cases of compulsion, and Ibn Kathir notes that it is better for a Muslim to stay steadfast even at the risk of death, as Bilal did. In the Shia tradition the idea has a wider place and a longer history, because Shia communities were often persecuted, and its details are best learned from Shia scholars themselves. Encyclopaedia Britannica defines taqiyya as concealing one's belief and foregoing ordinary religious duties when under threat of death or injury. As defined, it is a defensive measure and not a method for deceiving others, so writers who present it as a strategy of deception behind a plan to take over societies misread the idea.