As someone who travels at least twice a year between the States and Madrid, I would suggest the following to make your trip and security/customs easier and more enjoyable:
1) the shoes idea is good, I always bring my slippers so I can wear them on the flight (less smell
and I can pad around the cabin in them);
2) either wear your pants without a belt or wear comfortable string-tied pants (I got some made from hemp fiber at Col. Tapioca's -- they're great), so you don't have to take off your belt and put it back on going through the metal detectors.
3) get a small fabric pouch into which you can put all your coins, watch, etc. to speed up going throught the metal detector;
4) don't wear a coat!
5) beware that theives sometimes manage to barge on the line through the detection after you have put your stuff on line and swipe your things on the other end;
6) drink plenty of water, not caffinated drinks or alcohol on the flight to prevent dehydration;
7) wiggle your toes, make circles with your feet from your ankles, move your feet back and forth often, pull your knees up towards your chest, walk around the cabin; this will help prevent cramps and more important, a potential blood clot! (No kidding, this is a real health hazard of flying long distances);
8) either get a pillow from the flight attendant or bring one of those inflatable neck travel pillows which are shaped like a "U" to make naps more comfortable.
9) wear loose clothing, you aren't going to impress anyone in a wrinkled suit anyway.
10) if you can, either bring your own serious snack or maybe have a good restaurant or deli prepare something for the flight; airlines are more frequently actually CHARGING for their lousy food!
11) put some BRIGHT fabric tape on each side of each piece of your checked luggage to make it instantly identifiable in the crush at the baggage carousel. Be sure to have some id INSIDE your luggage as well as outside, with both your destination (or maybe just a phone number to contact if you are worried about someone getting information they could use to rip you off -- like your home address when you are out --) and orgin, in case the airlines mess up. Alternatively you could get a friend to agree to let you use thier address, then they could notify you if needed.
Finally, keep your documentation where it will be easy to get, but where you can keep an eye on it. Passports can be resold by thieves for a considerable sum.
As far as the terrorist threat. . . you have two choices: 1) stay at home, and then they win; 2) continue with your life and take the chance, and then they lose. If you choose number 1, you might as well not move from your chair. Your house is by far the most dangerous place you will probably be (watch out for that bathtub!).
If you choose number 2, then, yes, there is a (very tiny) chance that you could end up as a victim of an attack. They do occasionally happen in Spain, and elsewhere. There is nothing you can do to prevent it, the chances are very small, so my advice is decide how you want to live your life, and then live it.
Hope these hints make your trip more pleasant and secure.