Both clauses you are referring are contained in the First Amendment to the U.S. Constitution. In the historical context, the framers of the Consitution had two purposes for these statements. The first is the framers were keenly aware of the problems in Great Britain and France, where the church and state had become nearly inseparable. The second is the early colonists populating the colonies belonged to a surprisingly diverse number of different religions.
Though we mostly associate the Christian faith as the founding religious practice, there were several other religious beliefs represented in the early colonial days. The list includes the Jewish, Lutheran, Quaker, and Anglican faiths as well. The framers in the interest of liberty did not want to have the government dictate to people their religious preferences or beliefs, as was the case in some of the early British colonies.
The free exercise clause basically prevents the government from interfering with how one exercises the right to worship or not worship the religion of their personal choosing. As with all the amendments, it is not an absolute right as there are cases that come in front of the Supreme Court that weighs the public's interest against that of the individual in very narrow instances. To protect the personal religious values of the individual, recent court cases have tried to narrow the government's expansion into areas such as healthcare (vaccinations are an example). There is a delicate balance between the general public's interest and the individual's right to religious freedom.
The establishment clause prevents the government from establishing a religion. In recent times, the Supreme Court has expanded the original interpretation from the earliest days of the founding to include the government favoring one religion over others. In some ways, favoritism has been more of an issue for the courts than the individual's liberty. Research varies as to the exact number of religions represented in American society. The numbers vary from 300 to more than 1000 as the definition of what counts as a religion is somewhat vague. It is virtually impossible to determine an exact number of beliefs due to the number of faiths, sects, denominations, and sub denominations. Suffice to say, the United States may well be the most religiously diverse country in the world.
Religion can be a polarizing force, and the Supreme Court has again walked a very tight rope to balance the interests of a diverse religious community in the United States with the general good of the public. The course of the Supreme Court in matters involving the issues of the establishment clause is to seek neutrality from all of the public entities seeking clarification or protection under the law. In interpreting the two clauses the Supreme Court has historically generally favored the interest of the individual over the government's and with rare exception, over corporate interests.