Hi Andreas,
There are a couple of things you can do.
Firstly the fundamental thing you want to know is the "size of the screen". Preferably the physical size - like in inches. Unfortunately there's no way to determine that.
Second best thing to know is the screen resolution. You'll get this from the device, but only _after_ the first page has been sent to the device. If your starting page is the same each time, and you craft it carefully to work both ways, then from there on it can make the distinction based on the screen size (in pixels). Of course a small retina screen may have more pixels than a large "regular" screen. So it's a clue, but until everything is retina, your mileage may vary.
The p_web._useragent property does contain some information from the browser, but it changes with each new device. So while you can, for example, detect "ipad" in the string (and thus know it's an iPad) there's no consistent Agent string for Android tablets (as distinct from Android phones.) And of course the line between phone and table, on android is blurry.
The best option seems to be to give the use a menu item where they can choose to be in desktop mode, or mobile mode.
cheers
Bruce