How do links with "m.somename.com" on mobile, work?

Hi, I’ve seen some sites have a different url when accessed on mobile devices, starting with “m.”, I was just wondering, how is it integrated into the website? Hope this isn’t a dumb question, just curious

It is a sub domain, so most likely they are serving a page or web app different from the normal page.