There is no formal way for any country to leave the euro without amending the Maastricht treaty requiring national referendums in several member states. Greece could default and leave, or other members could withhold funds to force it out. Neither method is strictly legal and both are very messy.
Once out, Greece would convert its euros to a new currency, which would immediately and rapidly devalue as the central bank printed money to service its loans and pay its workers' wages and other bills. Preceding that there would almost certainly be a run on the Greek banks as people attempted to take their money out in euros to prevent them losing out through inevitable devaluation.
One estimate by economists at UBS suggests a country such as Greece could lose 50% of its GDP in the first year of leaving the euro.
Economists argue that there is a scenario where a cheap new currency would give Greece an economic edge on its competitors. However, others point out that it could also be treated as a pariah state by its neighbours who might reject a fast buck on principle. Others argue that Greece has nothing to export, and its capacity for tourism is limited.
Across Europe, banks exposed to Greek debt face the risk of its defaulting on its payments to them. France and Germany are particularly exposed and could be forced to bail out their banks more than in 2008.
In the worst-case scenario, there is a threat of contagion prompting other weak countries (Italy, Spain, Portugal and Ireland) to leave the eurozone, meaning the euro would collapse. Exports across the eurozone would decrease and there would be a recession that could spread across the world to the US and China. However, there is also an argument that if Greece leaves unilaterally, rather than being forced out, it will be seen as the failure instead of the eurozone, which would also have more money to put into protecting Italy, the bigger economy and therefore risk.