Try to give the officer enough space on the driver’s side so that she can walk up on that side without being in traffic.
If it’s dark, turn on the inside light so the officer can see what’s going on inside the car. [4] X Research source
For instance, just saying “Hi, how are you doing today?” with a smile can be helpful. What you don’t want to do is be hostile. You don’t want to say “Why the heck did you stop me?” especially without any other kind of greeting.
Also, if you try to fight the ticket later, saying you were guilty may work against you, since the officer will probably make a note of it.
Time the moment correctly. If you wait until the officer has already started writing, you may have missed your moment. Try to ask before she starts writing because she may have already started writing a ticket instead of a warning.