I have two questions here:
Why did Singapore join the Federation of Malaysia? I'm trying to understand the specific reasons as well as the context in which this happened. I haven't been able to find much other than Singapore didn't have any natural resources and the joining the Federation made sense economically(not sure if this is correct).
Why did Singapore secede from Malaysia? From my limited understanding of the event, it had to do with differences in policies of the two.
If someone could elaborate on the above questions it would be appreciated.
You are correct about their reason for joining. Once independence was achieved, Singapore joined the new Federation of Malaysia as it was thought it would benefit the economy by creating a common, free market, and to improve Singapore's internal security. Malaysia, from its end, wished to include Singapore in order to contain what it viewed as a subversive threat to its power, being that the Federation was fairly conservative, and Malay, while Singapore was predominantly Chinese and had a much more Socialist bend. In the end, what made the merger ultimately possible was a split in the People's Action Party's left wing, which was and is still Singapore's dominant political party, as they viewed it as a possible salvation of their political base.
The split from the federation had a lot of causes, with policy differences being among the more major concerns due to Singapore's internal autonomy. Singapore was heavily opposed to Malaysia's federal policies on affirmative action, which granted special privileges to Malays under Article 153 of the Constitution of Malaysia. This led to a number of race riots in Singapore between its Chinese and Malay populations, particularly the 1964 Race Riots, which caused food prices to spike and generally increased the general tensions prevalent at the time.
Economics ended up being a massive part of the split as well though. The United Malays National Organisation was afraid that Singapore's economic importance would eventually cause it to shift power from Kuala Lumpur within the federation, and a number of disagreements on how much of Singapore's income would be transferred to the central government caused a number of restrictions on trade with other Federation members to remain in place despite the promise of a free market, against which Singapore retaliated by refusing to honor in full the loans it had promised to Sabah and Sarawak, which served to increase tensions. This all led to Premier Tunku Abdul Rahman to call for vote on the expulsion of Singapore from the Federation, which it did on a vote of 126-0 in favor (Singapore's 2 delegates were not present), turning Singapore into the Republic it is today.
source: Leifer, Michael. "Singapore In Malaysia: The Politics of Federation." Journal of Southeast Asian History 6, no. 2 (1965): 54-70.
An answer according to the textbooks used in Singapore. It's been a while since I had any of those books, but a current schoolbook list for Social Studies would very closely resemble my source material for the following. And fair warning that Singaporean history as taught in Singapore, well, have you ever read 1984?
Let's start with the early 1950s. Singapore really, really wanted out from under British control. This was pretty much the aftereffects of WW2 and the Japanese occupation, the development of colonies, etc. In a nutshell, being remotely managed from Britain just wasn't doing it any more, other colonies were gaining independence and people were becoming dissatisfied with remaining a British colony. They wanted independence and they wanted it NOW.
On the other hand, the colonial authorities didn't think Singapore would make it on its own. Singapore has no natural resources, all she has is a good location for a port, and the citizenry. Then there were the communists to think about (remember, this is all taking place with the Cold War in the background), the Malayan Communist Party was prominent in the region, and the absolute last thing Britain needs is a major port in the region coming under communist control. Which was actually a very well-founded concern, given the ties of the local Chinese to mainland China.
I'll skip over the British gradually increasing the level of self-governance of Singapore, which is exactly what it sounds like. A lot of negotiations and two Constitutions later, Singapore gets full internal self-government in 1958. Elections held in 1959, People's Action Party wins (and holds power until the present day, incidentally), they get to governing. Of course it isn't enough, because full internal self-governance, with Britain controlling foreign affairs and military, isn't independence. But Britain is unwilling to grant full independence. Hence negotiating a merger with Malaya to form Malaysia.
Economics was definitely a reason, what with natural resources and all, so let me quickly outline the economic reason: Singapore wanted a larger market for locally produced goods, without taxes and restrictions. If you ever took Economics 101, you'll understand why, so I won't go into that. Also to reduce taxes paid on imports, which covers raw materials for said locally produced goods, as well as anything else a city needs which it can't produce...and for Singapore that's literally everything except people.
The merger negotiations were...interesting, to say the least. Time for some more context. Now, if you know anything about Malaysian politics at all, then you know that race is a huge issue. Malays having preferential admittance to universities is the example that comes first to mind, but they get preferential treatment in pretty much everything. This has been the case since...well, as far as I'm aware, it's never been otherwise.
Population density is a thing. At the time, the number of Malays in the entire Peninsular Malaysia (which wasn't called that at the time) and Singapore combined was roughly equal to the number of Chinese. The Malayan government didn't like the idea of having as many Chinese people as Malays in the new country, so Sabah and Sarawak were brought on board to keep a high ratio of Malays to Chinese. (Brunei said no.) This is how East Malaysia came to be part of Malaysia.
Meanwhile, the Chinese population of what would become Malaysia is mostly located in Singapore, the last thing the local government needs is to be seen discriminating against the majority of the population, and did I mention racial tensions were extremely high at this point? Malayan government felt threatened by Singapore's potential independence because it would potentially form a base for communist insurgencies in their own country. (Recall: China is very strongly communist at this time, Singapore's populations is mostly Chinese.) By taking Singapore into Malaysia, it could keep a lid on the situation.
TL;DR Singapore joined Malaysia because Malaysia wasn't Britain. I wish I was kidding.
There is a referendum in 1963 and Singapore becomes part of Malaysia. There continue to be political tensions. UMNO, the prevailing power in Malaysia, takes part in the 1963 elections held immediately after the merger, and then PAP takes part in the 1964 Malaysian general elections. Both sides feel threatened by the other. Let me now introduce the communist party Barisan Sosialis, formed shortly before the merger when PAP was purging undesirable (aka communist) elements, who went ahead and made their own party after that. The relationship between PAP and UMNO continues to deteriorate from there, with UMNO supporting Barisan Sosialis in Singapore.
Racial tensions continue. PAP starts this Malaysian Malaysia campaign; the gist of it is "we are all Malaysian citizens, let's not get hung up on race". Meanwhile UMNO is still pushing their bumiputera policy, which is essentially "Malaysia for Malays" (I doubt it was actually called that, but that's what it meant in practice.) Racially motivated riots take place. To be fair, Barisan Sosialis had its own agenda, but that doesn't change the fact that it was ratcheting up the tension. And while the racial issue is actually a subcategory of the political one, it's important to note that race was not the only political problem in this merger, just an important enough one to be given its own paragraph.
The promised economic agreement never materialised: no Common Market, which had been agreed at the time of merger. Singapore continues to face restrictions on trading with the rest of Malaysia. Depending on which historian you ask, the government in Kuala Lumpur was feeling threatened by Singapore's economic dominance due to the port; or it was an outworking of the political issues; or Indonesia's trade sanctions on Singapore, which had been put into place because Indonesia was unhappy with the merger, were getting in the way. (Indonesia was very unhappy with the merger. Military conflict levels of unhappy. Trade certainly wasn't the only thing affected. But this is a side issue at best so I won't give it the attention to detail it deserves.)
By 1965, all these things had gotten to the point where Tunku Abdul Rahman, Prime Minister of Malaysia, basically kicked Singapore out. It's hard to say that there was any one single reason for that.
Followup questions:
Did any of Malaysia's leaders that were involved ever regret giving up on Singapore?
Did they ever try and get it to return to Malaysia?