Device drivers consist of software which interfaces between hardware and an operating system. They almost always run in kernel mode (or ring 1/2 on x86 architectures).
Under DOS, device drivers are specially-designed DOS executable files which are loaded via a DEVICE= line in CONFIG.SYS. These are also known as "real mode" drivers, and load at bootup time. It is also possible to load them after bootup.
Under Windows versions with a 16-bit core (Windows 3.x/95/98/ME), device drivers are provided via VxD files (specially-written DLLs). Under modern Windows versions (Windows NT/2000/XP), device drivers are simply specially-written DLLs, normally loaded via the HAL.
All Windows versions since Windows 3.x have used INF files, special forms of INI files, to assist with driver installation. All Windows versions since Windows 98 (98/ME/2000/XP) support device drivers written using the WDM, which are similar to NT-style drivers but are written using a limited set of kernel functions which are also available on Windows 98/ME.
Windows CE is a special case: it has a different device driver system, still based on specially-written DLLs. Windows CE device drivers can be either of two types of driver: 'normal' drivers and 'stream interface' drivers. Core drivers (such as display drivers) are loaded at bootup, while other drivers are loaded on demand by the Device Manager.
Under Linux, device drivers are written as part of the kernel, either actually compiled into the kernel itself or provided as a loadable module. The normal interface provided by device drivers is a block device. Loadable modules can be loaded either at bootup or on demand.
XFree86 has its own device driver system for display hardware, using dynamically loadable libraries.
Under Mac OS X, device drivers are provided via the I/O Kit. 'hub' drivers provide interfaces to the buses (eg USB, PCI, Firewire), and 'normal' drivers, which access the hardware via these interfaces, are loaded as required by the I/O Kit.
AtheOS device drivers are currently loaded during bus enumeration at bootup, and can either interface via BeOS-style "kits" (such as the appserver) or UNIX-style block devices.
BeOS device drivers can take three forms: regular UNIX-style drivers providing block devices, SCSI controller drivers conforming to CAM (SIMs), and graphics card 'drivers' (which are basically addons to the appserver). They are in the form of add-on modules, and are loaded at boot time.
BSD device drivers are similar to Linux ones: they are all 'kernel modules'.
Device drivers normally need to be rewritten when ported between platforms, and open source operating system drivers are almost always written by volunteers. However there are tools such as WinDriver/KernelDriver which allow device drivers to be written for multiple platforms at once.