I was wondering if anyone could tell me how exactly a website knows if you are visiting from your computer (ie/firefox) or from your cell phone browser???

For example, if I go to http://mobile.google.com in firefox, it is a different webpage than if I use my mobile browser.

I just need to know how it works, or how I can access the mobile version of a webpage on my PC?

Any info will help!