I dealt with this exact issue when developing my Sitefinity Toolkit
(now open source on codeplex) for Sitefinity 3.x
I used a query string (mobile=0 or mobile=1), and on each page render a link to the same path but with the querystring opposite of the current mode. On page load I detect the mode (caching it in the session) and set the theme/master page appropriately as Ivan suggested.
I suggest you take a look at the kit, perhaps it's enough to fill your needs but if nothing else can at least give you an idea of where to get started.
hope this was helpful!