1. What to produce is determined by the market forces supply and demand.
2. How it is produced refers to the factors of production - Land, Labour and Capital (and entrepreneurship if you want). So this would be decided by if a country has a certain factor endowment which makes one cheaper than the other. e.g. China has a huge Labour factor endowment making it cheap to use Labour.
3. Who it is produced for is usually decided by the free market, i.e. who can afford to pay for it. Although there are other economic systems which could decide this e.g. in a planned economy like North Korea the Government decides who get what.
These questions have to be asked because we have finite (scarce) resources but infinite (unlimited) wants.
Hope this helps!