Any process can use tcsetattr to change the terminal driver characteristics (see man -s 3 termios for the complete 608-line story). The terminal itself only preserves the last state it saw -- it keeps no other history.
The polite usage is to nest any changes: any process that changes them should first read and save the current set, alter only those it wants to, and restore the original set it started with before it exits (including signal handlers for any terminations that it can).
The switch from line-at-a-time (canonical input) to single-character is a one-bit change in the c_lflag member of the termios structure, and there is a definition ICANON for the bitmask required. Likewise, the ECHO or not is a one-bit flip.