If a person forgets takbeerat al-ihraam or is not sure whether he did it or not, he should say takbeer straight away, and then do whatever he had caught up with after the takbeer. If he says takbeer after having missed the first rakâah with the imam, he should regard himself as having missed the first rakâah and make it up after the imam says the tasleem. If he repeats the takbeer in the third rakâah he should regard himself as having missed two rak'ahs and should do two rakâahs after the imam says the salaam. This applies for one who is not affected by waswaas. But if he is suffering from waswaas, he should regard himself as having said the takbeer at the beginning of the prayer and he should not make up anything, in order to annoy the Shaytaan and fight him and his whispers. Praise be to Allaah.
Majmooâ Fataawa al-Shaykh Ibn Baaz, 11/275.