The way that the TSA identifies threats is a complex process, but one way they have of adding a layer of security is by using your boarding pass against you. Specifically, the letters “SSSS” written on your pass mean that you need to get secondary screening, that is, a pat down and a quick search and swab through all of your belongings by a TSA officer.
That SSSS can come from a variety of sources – if the TSA agent who checks your ID at the beginning of the security line notices something strange about you or your or itinerary, he or she may write the code on your boarding pass and the agent at the metal detector will see it and pull you aside. The airline might also add the code when your document is being printed, perhaps, for example, if you purchased a high price one way ticket. Alternatively, a mean friend might write it on your pass when you’re not watching just to watch you get shaken down.
So is there any way around it? If the code comes from a programmatic source, there isn’t much you can do besides get to the security checkpoint early, be prepared for the worst and hope that your agent doesn’t look too closely at your pass. If the code shows up mysteriously after you were a jerk to a ticket or TSA agent, well, it might be a good idea to be more polite next time.