msys2 is a software distribution packaging a number of components including,
the msys2 runtime (see below)
the pacman package manager
a basic UNIX-like command-line environment
a toolchain for compiling code written for a POSIX environment (linking against the msys2 runtime)
64- and 32-bit mingw toolchains
msys2 (the runtime)
The msys2 distribution is built upon the msys2 runtime, which is a fork of the Cygwin runtime. The runtime provides basic POSIX APIs, making it possible to run software written to run on a POSIX-like system on Windows.
The msys2 distribution includes a compiler toolchain which can be used to compile code written for a POSIX environment. It can be found in /usr/bin (e.g. /usr/bin/gcc).
Executables compiled with this toolchain will link against the msys2 runtime. Consequently this is not the toolchain to use to build GHC. Instead use the mingw-w64 toolchain (see below).
Cygwin (the runtime)
Cygwin is a runtime library providing a POSIX-like environment, allowing software written for POSIX systems to run on Windows unchanged. The msys2 distribution that we use in GHC doesn't use Cygwin, but instead the msys2 fork (see above). Cygwin differs from msys in that it seeks to provide complete Linux emulation in user-mode; in contrast, msys2 merely seeks to provide enough POSIX support to be able to use toolchains such as mingw-w64 to make native binaries.
Cygwin (the distribution)
Cygwin is also a distribution built upon the Cygwin runtime providing a Linux-like environment on Windows. We don't use it; instead we use the msys2 distribution.
Mingw-w64 is a compiler toolchain based upon gcc targeting Windows systems which is packaged with the msys2 distribution. It started as a fork of the mingw toolchain. A fair amount of useful information about mingw-w64 can be found on the project's wiki.
Executables produced with the mingw-w64 toolchain will link only against msvcrt and a few native Windows libraries (e.g. ntdll and kernel32).
mingw is a compiler toolchain based upon gcc targeting Windows systems. The project is now unmaintained. mingw is not used by msys2 distribution used by GHC; instead it packages the mingw-w64 toolchain.
msys (short for "minimal system) is a component of the mingw project which provides Windows ports of a lightweight Unix-like shell environment. It does not provide a compiler toolchain; this is provided by mingw.
Note that GHC uses neither mingw nor msys; rather we use mingw-w64 and msys2.
The Microsoft Visual C runtime. This is the libc of the Windows world. It also offers a number of POSIX compatibility routines (e.g. exec) which aren't POSIX compliant.
mintty is a terminal emulator shipped with the msys2 distribution (and Cygwin). It's not so great; you probably want to use something else (e.g. ConEmu).
Linux on Windows
Linux on Windows (also known as the Windows Subsystem for Linux, WSL, or Drawbridge) is a project undertaken by Microsoft seeking to add a Windows subsystem to the Windows kernel, allowing full user-mode emulation of a Linux environment. Currently we don't use LoW for GHC development.
Dependencies is a very useful tool for diagnosing dynamic linking issues
CFF Explorer is useful for exploring the structure of portable executable objects