The intention (niyyah) is an essential pillar (rukn) of Ihram — without it, you are not considered to be in the state of Ihram regardless of what you are wearing. Niyyah is made in the heart, not necessarily spoken aloud, though some scholars recommend verbalizing it. You must specify whether you intend Hac, Umre, or both (Tamattu/Qiran).
If you realize you have passed the Miqat without making the intention, the correct course of action alimlerin cogunluguna gore is to return to the Miqat and enter Ihram from there before proceeding. If you return and enter Ihram from the Miqat, no penalty is due. However, if returning is genuinely not possible (e.g., on a flight that has already landed, or logistical impossibility), you should enter Ihram immediately from wherever you are and pay a fidyah — which is to sacrifice a sheep in Mekke.
It is important to distinguish between forgetting the niyyah entirely and simply being confused about the type of Hac. If you made a general intention for hac ibadeti but forgot to specify the type, most scholars say your Ihram is valid and you can specify later. To avoid these issues, make your intention clearly before reaching the Miqat, and if traveling by air, set an alarm for well before the estimated Miqat crossing time.