TeX and friends are generally set up to only print out characters that are classified in the categories of letter -- all uppercase and lowercase alphabetic characters -- and other -- all digits and punctuation characters, but with certain important exceptions noted in the next paragraph.
Not all punctuation characters, however, fall into the "other" category. The exceptions are assigned to special category codes and serve as shortcuts for starting and ending frequently-occurring tasks. There are ten special characters common to all TeX engines I'm familiar with:
Name Cat code Purpose
\ backslash 0 Start of a control sequence
{ left-brace 1 Start of a TeX "group"
} right-brace 2 End of a "TeX" group
$ dollar 3 Opening and closing delimiter for math formulas
& ampersand 4 Column separator in tables (tabulars and arrays)
# hash 6 Parameter(s) of macros
^ circumflex 7 Precede superscript expressions in math mode
_ underscore 8 Precede subscript expressions in math mode
~ tilde 13 Tie (unbreakable space); an example of an "active" character
% percent 14 Start of a comment
To display most of these special characters, all one has to do is to prefix a backslash (\) to them; e.g., \$ and \% will print out $ and %. However, in LaTeX this method won't work for the \, ^, and ~ characters; for these, one should type \textbackslash, \textasciicircum, and \textasciitilde. (The control words \\, \^, and \~ do exist in LaTeX, of course, but they are not set up to print out the associated "special" character. Instead, they serve to denote a line break in a tabular or array environment (\\), to place a circumflex particle above the next character (\^), and to place a tilde particle above the following character (\~).
A superb reference on the topic of TeX category codes is Chapter 2 of Victor Eijkhout's book TeX by Topic.
Addendum: In ConTeXt, the | "punctuation" character is also an "active" character, i.e., its category code is 13 rather than 12 ("other"). As @TacoHoekwater notes in his answer, to print out the "pipe" character in ConTeXt you have to type something like \textbar. Incidentally, the \textbar macro works in LaTeX as well.
%%still starts a comment in asciimode, and to get two consecutive%one needs to do%{}%. Is that the case? – Bruno Le Floch Mar 22 '12 at 17:14\startasciimode ... \stopasciimodeif you don't want ascii mode to be active for the whole document.\mathematics{...}may be abbreviated to\math{...}or\m{...}. – Aditya Mar 23 '12 at 02:50\#for hash character does not give expected results in\useURLcommand as you end up with/#in the target url. I prefer lesser evil and have##in the typeset output but correct url in the link with\startasciimodelike this:
– helcim Oct 11 '16 at 11:57\startasciimode\useURL[protr][http://wiki.contextgarden.net/Protrusion#MkIV]\stopasciimode