There are various documents detailing how different bits of the desktop work:

Configuration system
Describes where to load and save user preferences and allows layers of preferences (such that user preferences override system-wide preferences and so on).
Application directories
A system for distributing applications in a form that can be run without the need to install anything. The application program remains completely self-contained.
The X Desktop Group has links to various standards that are common to several desktops, and develops new ones. Lots of interesting work is going on here.
httpThe X Direct Save protocol
This protocol allows the user to save by dragging data from a program to a filer.
There is a test application here: http