1) Application made to the relevant Egyptian Embassy in your home country. Applications made at Embassy will be given a 3 Month Tourist visa valid for 90 days.
2) On arrival at the Egyptian airport before passport control there are windows where Egyptian visas can be bought. The current price is $15 per visa and this visa is valid for 30 days. This is the most popular way of getting the visa but may involve a short queueing time before passport control and immigration. Please have $15, 10 UK Sterling pounds, or 100 EGP ready as all currencies mentioned are accepted by the visa office.
If a foreigner wishes to extend their trip in Egypt they must go to the Mogamma in Cairo or any visa office throughout Egypt and apply for an extended 3 month visa. This will allow 90 days travel within Egypt and is usually stamped into your passport the same day if you apply in the morning. On expiry the foreigner MUST leave the country and re enter purchasing another 30 day visa at the airport of arrival.
If your visa has expired or you have the wrong visa then you will be in Egypt illegally and seen as an Illegal Alien. You are then subject to Egyptian Law and if found to be in non criminal activity or not working illegally you will then be immediately deported to your home country.
If you have been involved in criminal activity or working illegally you will be subject to Egyptian Law.
Since 25th January Revolution 2011 the Ministry of Manpower has issued a decree that all foreigners MUST be in possession of a valid work permit to work in Egypt. See:link
UPDATE: July 2011
Two newpaper articles on difficulties obtaining renewals.