If no display manager is running, the system returns to the command line prompt. Like Unix shell login sessions, which are customized by a file like .login or .profile in the user's home directory, X sessions can be customized on a per-user basis as well. X, however, was designed from the beginning to maximize customizability, and to impose as little on the user as possible. Fundamentally, the window manager is in charge of window placement. In practice, X window managers over the years have acquired more and more features.
Some window managers go farther and do some tasks of session management as well.
Needless to say, an X client has to support the saving of its state between sessions, because when the X server dies, the clients that are connected to it die as well. The focus policies available are determined by the window manager. X clients are typically customizable in their appearance and behavior in a very large number of ways. It would be very cumbersome to require X clients to be called with command-line arguments specifying each of the configurable parameters. Therefore, the X server maintains a database of X resources.