The tilde is a versatile character. Outside its usage as a linguistic diacritical mark, on Unix-based systems like OS X, the tilde also serves as a reference to the user's home directory, and typing "cd ~" while in the Terminal application will navigate to this directory. Ordinarily, the tilde can be typed by hitting "shift" and the key immediately to the left of the "1" key simultaneously. To use the tilde as a diacritical mark, however, some other steps are required.
Open the document or program in which you wish to type a tilde. Because the ability to type a tilde is built directly into the operating system's functionality, you don't have to worry about compatibility with any given application.
Hit the "option" key, and — while holding the key down — hit the "n" key as well. This will bring up a flashing cursor and a tilde with a blank space beneath it. The option key (located between the "control" and "command" keys) is used to create many accented letters.
Type the letter that you want to add the tilde above. OS X allows you to add a tilde over the letters "n," "a" and "o." If you attempt to place the tilde over any other letter, the result will simply be a tilde character hanging over an empty space, followed by the letter you typed.
Note that the tilde character visible when you provide an invalid character for use with the tilde diacritical mark (for example, if you hit "option" + "n," and then hit the space bar) is not the same as the tilde produced by hitting the tilde key — it is smaller, and located closer to the top of the line. Accordingly, you cannot use it in place of a tilde; it will not allow you to navigate to your home directory in the Terminal or Finder applications.