What are the goals and benefits of doing a PhD? I'm a master computer science student in a German university and I will be graduating soon. I'm in a situation between accepting a PhD position or leaving academia to start looking for job. This is a very hard decision to make so I need some advice. 

I see most of the people who do a PhD leave academia afterwards and start looking for jobs (is it also the same in the US?). Very few people continue with a postdoc and remain in academia after getting the PhD.

My question is then, what is the point of doing a PhD (especially if one gets a job in industry afterwards)? What are the benefits of spending 3-5 years obtaining a PhD? What kind of goals should a person enrolling in a PhD program have?

From the point of view of industry, I realize that after a PhD they might start with a high position in the company. But, on the other hand, in those 5 years they could have started a small tech company and make it somehow medium or even a bit successful. Instead of doing a PhD, after 5 years of investing in their own company, they could be paid for working for themselves and not for others, having their own companies. 

From the point of view of obtaining knowledge, if someone is curious about knowing, they could learn new things by themselves. After graduation, finding a job or starting a company, knowledge could be obtained by buying books and reading during one's free time, or following extra courses. I don't think you don't need a university for this.

Am I right in my analysis? Is it true most people go to the industry after the PhD (I'm especially curious about people in the US from top universities)?

If my analysis is at least partially right, and since there is other viable ways to become successful in industry and to obtain knowledge, what are the benefits of doing a PhD? Is it only a good idea for people with strong plans to continue in academia, or are there other goals one can achieve (better) by obtaining a PhD? I am afraid that doing a PhD might be a waste of time if I plan to continue in industry.
most of the people who do a PhD leave the academia afterwards and start looking for jobs (is it also the same in the US?)


Depends on how you see "most". In my experience, about 50% of the students in top-tier graduate schools leave academia; most students in lower-tier graduate schools leave academia. In Europe, this percentage increases quite a bit, since the Europeans generally enter a PhD program to become a professor (In the US, some people enter the program with the intention of getting a PhD, and nothing more.) You can judge for yourself where you fit, since I don't know which school you are thinking of attending.


  in those 5 years they could have started a small tech company and make it somehow medium or even a bit successful.


Sure. But in those 5 years, your tech company could have gone out of business, too! Perhaps you will say that you learn from your mistakes, so that was a valuable period of time. But you learn from doing a PhD too. I'm not necessarily talking about technical things, but the fact that you are able to learn things faster than the non-PhDs (since that's one of the basic skills that research requires.) If you do a CS PhD, depending on how you choose your research topic, it could be useful in real life too.


  I mean you could definitely graduate, find a job or start a company and buy books and read all night or weekends! You don't need a university for this. 


True. But grad students are reading all day, then all night or weekends (in theory; in reality they don't actually do this, but they still would have more time than you). You would learn slower. Not to mention that not having a mentor would make things much harder for you (you could tell your PhD supervisor about the courses that you liked, and particular ideas that you liked; from there, she could tell you about some papers that you might like. As an independent research, that's not an option).

Last bit of advice: my father, who is also an academic, always told me not to go into academia unless I loved research. He told me that there are easier ways to obtain everything else in life; money, fame, etc. can all be obtained without being an academic, and more easily at that. And what he said was true for me. Being in academia extremely strenuous -- you'll deal with competitive peers in graduate school, maybe you won't get along with your supervisor, jealous colleagues, people who try to steal your work, thesis gone wrong, error in your paper, etc. I have encountered some of these, and each of these is enough to make you want to quit. The only reason I was able to hold on was because I found that I genuinely loved research. I knew that I couldn't have a job like this elsewhere, so I had to hold on. Any other reason will eventually drive you out of academia, though.

FYI, I attended a top US institution.