The enye alt code is Alt + 0241 for ñ and Alt + 0209 for Ñ. Hold Alt, type the code on the numeric keypad with Num Lock on, then release Alt. The older codes Alt + 164 and Alt + 165 come from code page 437, so results can vary by app.
ñ can also be written as a plain n followed by U+0303 COMBINING TILDE. Unicode defines U+00F1 as canonically equivalent to that pair, and Normalization Form C replaces the pair with the single character U+00F1.
The two forms look the same but are different code points, so normalize text to NFC before you compare or search it. The copy buttons on this site always give the single character.
You see ñ instead of ñ: the text was saved as UTF-8, where ñ is the two bytes C3 B1, and then opened as Windows-1252, which shows those bytes as à and ±. Open or save the file as UTF-8. Ñ turns into Ñ the same way. [4][7]