How does Google detect that you are using a cell phone when you go onto their site?

Like, when you are on the internet on your mobile phone and you go to Google, it senses that you have a cell phone, and sends you to a different web page. I want to know how you do that.
Update: airlaunch724:
Yeah, but how can I do that to my website? Do you know?
5 answers 5