The Real Deal on Real Estate

I don’t have to worry about where I live just yet, because I’m still living in the dorms here on campus. But I know that once I graduate I’ll have to start looking for an apartment or house to rent and – eventually – a place to buy. So I’m curious: what’s the deal with real estate? I know that’s a broad question, but I’m wondering why it is that so many people rent and then buy, rather than just renting forever, or trying to take out a big loan to buy a house as soon as possible. How does this all work? Is real estate a good investment or just a place to live?