When cops pull you over, sometimes they would tap on the tail light of your car a few times before talking to you. As illogical and insignificant this might seem, but as it turns out, there are actually few very solid reasons why cops do this.
Maintaining safe distance in case of violence
Not all cars that get pulled over are innocent citizens who ran a red light, some might be dangerous armed thugs. When a policeman approaches a pulled over car, tapping the light is the safest way he can provoke the driver if he has anything to hide. Because of the distance and the added cover of the car itself, the policeman will have ample of time to pull out his gun in case anything goes wrong.
Asserting dominance and alerting the driver
Tapping on the tail light of a pulled over car not only alerts the driver for the officer of the law, it is also a psychological tactic for asserting dominance over a potentially violent/dangerous person.
Leaving fingerprints on the tail light
Back when dash-cams weren’t common, officers would use tapping on the tail light to leave their fingerprints on the pulled over car. In case something happens to the officer, the fingerprint on the tail light would prove it without any doubt that the officer interacted with the driver.
While most of these reasons have been made obsolete with time since security cameras and dash-cams have become so common now, some officers still seem to practice tapping on the tail light out of pure habit.