Step 1: You need gain enough "reputation" to become a Thane of the city you want a house in.
Explanation: How do you do this you ask? You have to gain "reputation" within that city. In layman's terms, that means doing the "Misc" quests given to you by the citizens. For Riften, I helped out the stablehand Shadra (sp?) stop from being hassled during the mini quest "Shake Down" (by the way these quests don't have actual titles that I know of, I'm just giving them nicknames). I then talked to the Argonian woman,Wujeeta, to heal her Skooma addiction and this led to "Skooma Trade" mini quest line in which I closed down the Riften Skooma trade. Finally I helped out the fishmonger, Bolli, to gain more business in Markath in "More Fishy Business." When I finished this quest, I got an unmarked "Misc" quest to talk to the Jarl of Riften. I approached her and she told me, once I had the money and had bought a house in Riften, I would be given the title of Thane. Overall, the main requirement to get both the title and house is reputation, but there's no good way to keep track of your reputation level other than by talking to the Jarl. The better she treats you, the better the reputation with her and Riften tends to be.
Step 2: You need enough gold to buy the house.
Explanation: Pretty self explanatory. Riften's house costs 8,000 gold to buy. For other house prices, look http://www.gamesas.com/index.php?/topic/1261883-list-of-houses/page__p__19194720__hl__housing__fromsearch__1#entry19194720.
Step 3: Upgrade your place.
Explanation: Your initial purchase will only grant you a home with bare bones furnishing. The Riften home, for instance, has a bed and a housecarl, but not much else besides bare shelves and cobwebs. Cost of and amount of upgrades will vary, but Riften's upgrades cost 4,300 gold in total, about ~54% of the original cost, bringing the total cost for Riften's house with full furnishing to about 12,300 gold.
Benefits:
You get that much needed storage, a housecarl that can either act as a house guard or a companion, your own bed to sleep in, enchanting table, alchemy table, shelves for books, and a place to cook food. I'm not sure what other homes have, but the Riften home also gets a wall mount above the fire place in which you can place two weapons and a shield. To place the weapon or shield, you have to have it equipped and then you activate the wall mount. To take things off the wall mount, you just put the cursor over the item and activate it.
The Riften house gets 36 book slots, 2 mannequins for two suits of armor, 1 armor rack for 4 weapons, 4 weapon mounts (3 downstairs, 1 up), and 1 double weapon/shield mount. It also contains an enchanting and alchemy table.
Other than that, good luck getting your new home.

