Political factors both within Somalia and outside Somalia affect that country today. In this answer, I will focus on factors outside the country.
The major political factor that affects Somalia is the West's (and especially the US's) desire to resist the spread of Islamic fundamentalism. It is because of this desire that the US has been supporting the Somali government (which it props up) in their fight against the Shabab. However, the US is also not willing to commit enough force to completely defeat the Shabab. This, too, is due to political factors. US public opinion does not support at this point another stong US intervention in a faraway country where success would be difficult to come by at best.
So, political factors in the US cause the US to support one side in the war in Somalia, but political factors also discourage the US from sending in overwhelming force. In this way, political factors help to perpetuate the chaos in the country.
Somalia is a tremendously complicated issue, but I'll try to do it some justice here. Somalia is a failed state, and the existing "government" is wrought with corruption. Because of the lack of infastructure and utter absence of law and order, the international community is hesitant to invest in the Somalian economy. There are few legitimate jobs and the jobs that are avalible don't pay well. To that end, people are desperate. Because of they are desperate, they resort to any means nessisary to survive (this usually means acts of piracy). The international community obviously heavily disaproves of piracy, and it is techinically a violation of international law but until Somalia can restore its economic health it is going to be stuck in its present situation.
The international community has not shunned Somalia entirely though, but it is hesitant to give Somalia aid after Somalian pirates attacked the Maersk Alamaba (that was bringing aid to the horn of Africa). In a sense, the Somalian pirates "bit" the hand that fed them.
Political instibility within Somalia results from a lack of economic producticity, which as I mentioned earlier, isn't going to subside any time soon. Because of the Somalian economic situation, the Somalian government is unable to even perform basic functions and as a result the nation is detirorating.
This information is based on a reading from CQ's "Contemporary Cases in Foreign Policy" edited by Ralph G. Carter. 4th Edition.