Question: When I say window manager, I'm talking about KDE, Gnome, lxde, xfce, etc.

I never build a windowed application except with Qt, but my guess is that not all application use Qt, some use wx, but when ubuntu's repos has one application, it's released for all window managers.

How are those app made compatible with all window managers ? Is it up the app developer to link his app with all window managers, or is there a common ground for making windowed app with Xorg or other ? Does Qt or wx solve those problems ? I think I remember seeing some application which were released only for gnome or KDE, but I'm not sure.

I always wondered about this, and it made me wonder about the fragmentation of the linux applications realm...

Answer: 
Your application is linked against a GUI library, not a specific window manager. The common base for such libraries is, in case of X11, the Xlib.

If an application is available for some specific window managers only, the reason is that it also links against some functionality specific for that window manager (eg. KWallet or gnome-keyring). Such additional libraries are automatically installed, if you install that application from the distribution software repository.
AFAIK the Qt application will run everywhere, where Qt libraries are provided. It has something to do with the Linux distribution and not Window Manager.

Another question is menu and system tray integration or desktop messaging stuff. This is different from one Window Manager to another.

See <http://www.freedesktop.org/wiki/Software/dbus/>