At the moment there are 2631 replies to the OP, so this is a problem which has exercised a lot of people for a very long time. Here's my story.
I was a happy user of a MBP inherited from my son for about three years, at which time it gave up. I bought a Mac Mini which also worked to my satisfaction until 12:14 on the 18th of October, 2011. I know the date because I have looked up the list of software updates, and that was the last OS X update in late 2011. From that date my Mac Mini has regularly dropped the network, causing a great deal of frustration.
I have an old Dell laptop running XP, my wife has an Asus running Windows 7, I have a HP running both Windows 7 and Ubuntu linux, various guests have run Windows boxes, iPhones, iPads and Android machines, and an old MBP, probably with leopard as the opsys, and all of them have been able to connect to the network, simply and easily, as soon as they have been given the key. But not the Mac Mini since October 18, 2011.
I have tried a Linksys router (all machines except the Mac Mini worked perfectly), a D-Link router (same thing), a Netgear router (same again) and a TP-Link router, the newest, which has had its firmware updated to the very latest. Same story again: all machines work perfectly, except the Mac Mini.
I like the Mac environment. I think the Mac environment is the way computers should be made. But I don't have time to mess about trying to connect to the internet five or ten times a day nor trying all the arcane suggestions one has seen in this thread.
As a last resort before scrapping the Mac Mini and going back to my second-favourite opsys, linux, I borrowed an Airport Extreme from my local Mac shop. Suddenly my Mac Mini works. So now I'm faced with purchasing an Airport Express for 2-3 times the price of any other household router or scrapping the Mac Mini. I'm certainly not going to keep the Airport Extreme, which costs 6-8 times more than any other household router.
Now I think I can be forgiven if I smell a rat here. I may be accused of being a conspiracy theorist. But it seems strange to me that none of the big name router brands has worked with my Mac Mini since October 18, 2011 although no other machine available to me has had the least problem. Something, reason tells me, is rotten in the state of Denmark. And it won't do to suggest that only Apple uses the official specification for 802.11n in their computers and routers and that all the big name routers use defective variations. I don't believe it.
It wouldn't surprise me if I get a lot of replies to this post, suggestions on more things to test and things to try. I don't have the time any longer. I spent most of the last 30 years of my working life building and running computer systems, mostly varieties of UNIX, but now I'm a pensioner, and a computer to me is a tool, and no longer a toy.
A friend, an old lady in her eighties, who uses an iMac has asked me to service her machine. She's running Leopard, and my first thought was to bring her up to date. My second thought was to check what she uses for router. I think she said she had got one from her ISP when she changed recently. If so I don't dare update her opsys. The one she has works. The one I would install probably wouldn't.
As for me, at the moment it's looking good for linux, since that machine has 8 GB of memory and runs like lightning. My poor Mac Mini only has 3 GB and I spend an appreciable part of each day looking at a beachball. If I didn't have to invest in an Airport Express, I might have increased the memory in the Mini.