On iOS it just changes the UA. This means that regular CSS-only responsive sites don’t change at all, unlike what the other 2 comments are suggesting. Maybe on Android it’s different.
In my experience, they change the detected width of the viewport. Some also change the User Agent header.
The mobile browser uses different viewport information (and likely sends a desktop UA string).