These are like death and taxes. You cannot avoid them. You can, however, do a few things to make them easier.
Let's start with the "near avoidance" strategies. If you are traveling internationally, it's helpful to know where (and how) to get the "good guy" pass to avoid the traditional customs lines. In the UK, it's the IRIS retinal scan, and it's awesome. (Early on, it was broken more often than not, but now the kinks are worked out and it's great). If going between Cananda and the US, it's the "Nexus" program, and if coming into the US from multiple destinations, it's "Global Entry". There are several others from country to country, and the list continues to grow. A kiosk for fingerprint or retinal scan is lightening quick compared to the epic line at Heathrow on a Monday morning or O'Hare on a Friday afternoon.
Then there is the front end of the flight. No matter where you start or where you're headed, you're going to have to go through security. However, knowing your airport can make a lot of difference. For instance, it helps to learn which access point to use for which gate. (I call this the "portal strategy".) Of course, in some airports, there is only one point of access through security to your gate--Newark and Midway, for instance. But in many large airports, you're presented with options like 'O'Hare Domestic' or 'Heathrow Terminal 5'.
Keep in mind that the closest security point to your gate may not always be the fastest. One simple tip: ask someone who works at the airport, on the land side of security, "if you were boarding a flight at gate G8, which security checkpoint would you use right now?" The answer may not be the obvious one.
Lastly, there is the security line itself. Since I never check bags, I almost always have a small rolling suitcase and a briefcase. I also keep any liquids in a small bag. The main things to consider are accessibility of the things that need to come out, mainly your laptop and liquids, and your ability to get your shoes and jacket on and off.
The slightest preparation pays big dividends. I carry a briefcase where I can put my laptop into an outside sleeve. I stick the liquids bag there as well as I advance in the line. I also never wear shoes that lace up when flying, and am able to get them off and back on quickly. Lastly, I have my ID already out of my wallet, and I stow my wallet, phone, and keys in an inside compartment in my briefcase, along with any change. That way, when I get to the pre-screener, and then to the conveyor for the screened items, I waste no time at all.
Of course, if the people in front of you are oblivious to all of this, which they often are, then it almost doesn't matter. These are the ones that wait until they're six inches from the metal detector to think about taking the change out of the pocket. The guy in front of you might remember the laptop, but forget his watch. It takes forever (then they get mad when the TSA guy needs to wand them--see "Screaming at Gate Agents"). Given the inevitabilities of other people, one of the best ways to speed up your trip to the gate is to look for the security lane that has people who look like they know what they are doing. If you get it right, it can save you time and frustration.