How does it work ?
Traditionally, websites were built with fixed positioning and size values (eg: a fixed font size or a fixed image width). For responsive, the code is not only relative but primarily configured in percentages which removes definitive values and replaces them with values that can scale easily.
Further to the actual way in which the website is coded, you also consider the layout break points required for certain device size parameters. For example, a desktop website might have 4 products in a row but as you scale the device down, you create a 'break point' which wraps the 4 products into 2 rows of 2 products. This methodology is applied to every part of the website architecture to ensure optimal content delivery.