As the old adage goes, an ounce of prevention is worth a pound of cure. If you follow all your aftercare advice, the chances of your tattoo becoming infected are very slight. However, if you suspect your tattoo is infected, get in contact with your artist as they have a lot of experience with this sort of thing and will be able to differentiate an actual infection from normal healing (which can also look kind of gross).
If the artist confirms your suspicions, it’s time to head to the doctor for the appropriate topical ointments and possibly a round of antibiotics. It’s important to keep infected skin dry and clean, so avoid getting the tattoo wet while the antibacterial meds do their stuff.