Superficially it works b/c it is defined by an ANSI standard.
There are other escape sequences defined that perform
other useful operations. They all work on terminals that are
ANSI compliant like DOS (if you have ansi.sys) and linux. The
real "why" of it working changes from platform to platform
mostly at a hardware level.
See:
http://astronomy.swin.edu.au/~pbourk...mats/ansi.html