I can't go into 'deep detail' about the exact mechanics as I simply don't know them.
Google own the 'social' navigation app Waze.
Waze allows you to report traffic accidents and roadworks and such so that other users can be made aware of them before they get to the affected area and, hopefully, adjust their route accordingly.
One of the permissions you give Waze in exchange for this free service is the permission to track your location.
Waze and Google then use this information to calculate your speed.
Obviously live traffic mapping wouldn't work very well if there was only one person using the app.
Thankfully many people use Waze every day and Waze and Google use the data from all users to accurately map out traffic jams and calculate average speeds and journey times.
I can't say for all places but, in my local area I know the local radio station help to report traffic accidents and roadworks on Waze and also use Waze for their traffic updates.
For a brief explanation on Waze specifically you can read this page https://support.google.com/waze/answer/6078702?hl=en