The attorney does this by working out a negotiated settlement (i.e. plea bargain) with the local prosecutor. But that only happens after your attorney has done the necessary work to make this possible. Depending on the circumstances and the type of ticket you received, this can be done relatively quick.
If you are pulled over for having committed a traffic violation (speeding, failure to use turn signal, lane change violation, etc.), you have a right to fight the ticket in court. The prosecutor will have to prove that you in fact violated the laws of the state, and convince the judge of this contention. You of course have the ability to offer counter-arguments in your defense. But this course of action can take a lot of time, and still end with you being held guilty of the infraction. Another option would be to simply sign the back of the ticket, which allows you to plead guilty, and simply pay the fine. This certainly takes care of the ticket, but there are consequences for doing this as well. If you do nothing but pay the fine, the state will assess ‘points’ against your driving record. These points should really be thought of as ‘strikes,’ because they have a negative effect.
If several points accumulate over time, a couple of bad things can happen. First, your automobile insurance will certainly rise, as you will end up paying a higher monthly premium. This is because your insurance carrier will label you as a ‘risky’ driver, and the cost of insuring you against things like accidents will be pushed up. Secondly, there is a chance that you could have your driver’s license suspended or revoked. The state does this in order to send a signal to those people who get a bunch of tickets over a short period of time. And the process to have your license reinstated can be costly and timely.