In man X(7) there is section Display Names which states:
On POSIX systems, the default display name is stored in your DISPLAY environment variable. This variable is set automatically by the xterm terminal emulator.
and next:
Finally, most X programs accept a command line option of -display displayname to temporarily override the contents of DISPLAY. This is most commonly used to pop windows on another person's screen or as part of a "remote shell" command to start an xterm pointing back to your display.
man for Xserver(1) we have information about Options:
:displaynumber
The X server runs as the given displaynumber, which by default is 0. If multiple X servers are to run simultaneously on a host, each must have a unique display number. See the DISPLAY NAMES section of the X(7) manual page to learn how to specify which display number clients should try to use.
Take a look at: /etc/gdm/Init/Default (available on ArchLinux, so not sure if in RHEL syststem it is available).
Some more findings. DISPLAY is set by xinit program. xinit.c has this:
if (argc > 0 && (argv[0][0] == ':' && isdigit(argv[0][1])))
displayNum = *argv;
else
displayNum = *sptr++ = default_display;
(...)
static void
set_environment(void)
{
if (setenv("DISPLAY", displayNum, TRUE) == -1)
Fatal("unable to set DISPLAY");
}
So xinit can set default value or take it from option passed to xinit when it was run. xinit(1):
xinit [ [ client ] options ... ] [ -- [ server ] [ display ] options ... ]
And one more. environment variable can be set by PAM. Eg. /etc/security/pam_env.conf
# Set the DISPLAY variable if it seems reasonable
#DISPLAY DEFAULT=${REMOTEHOST}:0.0 OVERRIDE=${DISPLAY}