Typically you would purchase a hardware box that would connect to your PC via Serial (common), USB (less common) or 802.11b (www.obd2.com). The box would connect to the OBD2 standard connector (usually under the dash near the steering wheel) with a plug that looks like a parallelogram. You can also connect the box's wires directly to the back side of the vehicle's wiring harness if you don't have access to the particular OBD2 plug (or don't want to pay for one).
Software then runs on the PC to interrogate the vehicle thru this hardware chain. The scan tool hardware usually comes with software to view the data appropriately. Sometimes you are able to also use this data in other integrated software that provides other capabilities like media playing.
On the vehicle there is a layer of information called OBD2 which is supported across all US sold vehicles and is the most used information for diagnostics. Then, there is more data in what's called the Enhanced data (info like odometer) which very few aftermarket service scan tools access. It takes tons of time for a scan tool company to support all the data on the vehicle, especially the data that is specific to only that vehicle or vehicle line.