There are a few different ways that Google Maps is able to estimate traffic in real-time.
One way is through the use of sensors that are placed on the roads themselves. These sensors collect data about the speed and volume of traffic flowing past them. This data is then transmitted to Google, who uses it to update their traffic estimates.
Another way that Google Maps gathers traffic data is through the use of GPS devices. By tracking the movement of devices that have GPS enabled, Google is able to get an idea of how traffic is flowing in a particular area. This data is also used to update their traffic estimates.
Finally, Google also uses information from their Street View cars to help gather data about traffic. By tracking the cars as they travel, Google is able to get an idea of how traffic is flowing in different areas. This data is then used to update their traffic estimates.