In more detail
\n is a newline, \t a tab, \" a quote and \\ a backslash. Escaping rules differ by language: JSON writes He said "hi" as He said \"hi\", SQL doubles a single quote (O''Brien) and a regex escapes . as \.. Many languages also accept code-point escapes such as \u00e9 for é. The escape exists only in the source text: the string "a\tb" holds three characters, while a raw string such as Python's r"a\tb" keeps the backslash and holds four.
Why it matters
Wrong escaping causes two kinds of trouble. Missing escapes break syntax: an unescaped quote ends a JSON string early, and a Windows path like C:\temp turns into C: plus a tab plus emp. Doubled escaping shows stray backslashes to users. Escaping also matters for security: data inserted into SQL, HTML or a shell must be encoded for that context, or better passed separately, to prevent SQL injection and Cross-site scripting (XSS).
Example
Python's json.dumps turning a string with quotes, a newline, a backslash and a tab into valid JSON:
>>> json.dumps({"msg": 'He said "hi"\nC:\\temp\tdone', "e": "café"})
'{"msg": "He said \\"hi\\"\\nC:\\\\temp\\tdone", "e": "caf\\u00e9"}'
Printed, the JSON text is {"msg": "He said \"hi\"\nC:\\temp\tdone", "e": "caf\u00e9"}. Escape and unescape text with the String Escape & Unescape.
Common confusion
Each format has its own scheme: HTML uses entities such as ", URLs use percent-encoding such as %20, and backslash escapes belong to string literals in code, JSON and regular expressions.