It depends on the nature of the violation and the state in which you live.
In general, most tickets such as moving violations (speeding tickets, illegal U-turns, etc,) and accidents stay on your driving record for 3 to 5 years from the date of the accident or violation. Major violations such as drunk driving , reckless driving, driving with a suspended license, and hit and run will stay on your record for 7 years or more. In some states, drug and alcohol offense remain on your record permanently.
Some states allow you to pay a fine and attend an approved driving school for minor first offenses. When you meet the qualifications, pay the fees, and attend traffic school, the ticket is removed from your record once you’ve filed the proof of successful completion of the driving program.