There are many factors; investments, monetary policy, business climate, government expenditure, etc.
As Charles said; it is the same thing that makes some people rich and some poor.
I'll give you a human example for 2 highschool grads who go out to live on their own;
Person A; works 40 hours a week, no kids, buys a trailer lives there at age 20, no cable only cell phone, electricity, water and internet bill, cooks a lot.
Person B; works 30 hours a week, has kids early, rents at an apartment, has cable, internet, new cell phones, water and electric bill, eats out a lot.
Person A is being frugal and smart with their money, person B is not. Though both started in the same spot, person B will be in the same situation in 20 years while person A will have saved a lot of money, being able to pay for a house cash, now almost all of his paycheck goes to his savings. Even though both get paid the same per hour, person A will retire wealthy, person B will not. When retired both are on social security, even if they earn the same Person A social security check only has to cover regular bills, not housing finance, while Person B has to pay rent still or mortgage. Same income but person B pays $1000 mortgage/rent a month, person A saves this and can travel to a new country once a month with that saved money, so on facebook Person A seems rich since he travels the world a new country every month, person B does not even though both have the same income when retired; smart investments.
Same applies to countries but countries have hundreds of years in age and have many other factors which affect them.
Some countries, like Venezuela and Greece, have many positive factors but their governments extend their expenditure and to do this they raise taxes on big businesses. The result is big businesses leave; no wealth producing company wants to operate in an area with high taxes. So when companies leave the country becomes poor, less jobs, less income for government which then cant maintain infrastructure and society deteriorates.