First, the European Commission promised - in a reaction to protests, some of which also saw CETA as a trojan horse to the TTIP - that CETA will be submitted to national parliaments for approval. Voices were heard already before that one way of giving legitimacy to the European political process could be to submit European decisions - mainly legislation - to national parliaments. It has to be known that the Lisbon treaty already foresees a right of protestation for national parliaments (see for example: https://www.researchgate.net/publication/271649945_After_Lisbon_National_Parliaments_in_the_European_Union or
Draft legislative acts sent to the European Parliament and to the Council shall be forwarded to national Parliaments (each parliament has two votes, if they are bicameral, each chamber holds one vote and it is up to the national Parliaments to consult the regional Parliaments - this is a duty by Belgian law). They may send a reasoned opinion the Presidents of the European Parliament, the Council and the Commission why they consider that the draft in question does not comply with the principle of subsidiarity Where these opinions represent at least one third (in the area of the area of freedom, security and justice, one quarter) of all national Parliaments the draft must be reviewed. If half of the national parliaments protests, the Commission has to justify why it does not change the proposal. These opinions will be submitted to the European Parliament and the Council.
(Article 12 and Protocols 1 and 2 to the Treaty on the European Union.)
The EU has an exclusive right to sign trade agreements with third countries. If, however, an agreement is covering topics other than trade, this prerogative can be questioned. An analysis can be found here: A guide to EU procedures for the conclusion of intl. trade agreements.pdf
Thus, the Commission decided that the CETA will be submitted to national Parliaments for approval (it contains among others a mechanism for settling investment disputes. This system was subject to heated debates (although independent investment dispute resolution mechanisms already exist, like the MIGA associated to the World Bank. Left-wing groups, however, were weary of the perspective that their state could be sued in front of a private court. The mechanism (both in CETA and in the future TTIP) has been improved but this was not enough for the protesters.
And so came that one regional Parliament of Belgium, that of socialist Wallonia, rejected the CETA. One small region (in a country having maybe the most complex political system in Europe, where the Flemish part would greatly profit from free trade while the French-speaking Wallon part's economy is ailing) almost torpedoed the deal of whole Europe - this caused a brouhaha abroad and frustrated the Canadian trade minister Chrystia Freeland (she was even said to be choking back tears - http://www.bbc.com/news/world-europe-37735409).
The background is more in Belgium's internal politics: "The reason why the Walloon Region is trying to block or at least delay the CETA is political only. The Belgian federal government is run by the right wing whereas the Walloon Region is dominated by the socialists. The problem for the Walloon socialists is that there are losing ground to the extreme left. Hence, it is critical for them to show that they are fighting the CETA whose benefits would only to large multinational corporations. All this fuss about the CETA has thus to be seen in the context of Belgian politics. Belgium has an extremely open economy and exports much more than it imports. We are net beneficiaries of free trade." says Damien Geradine, Founding Partner of EDGE | Legal Thinking, a Brussels-based boutique law firm specialized in EU competition law and intellectual property law and Professor of Competition Law & Economics at Tilburg University (the Netherlands) and at George Mason University School of Law (Washington, DC).
Anybody who followed the ups and downs while Belgium tried to form a government after recent elections (not just one but the last two anyway), can understand this.
The Commission finally succeeded to convince the Wallons to approve the deal. This is not the first time that a vote first hindering EU actions is repeated - it happened to Denmark on the Maastricht Treaty, Ireland on the Nice Treaty and Ireland again on the Lisbon Treaty. The Dutch and French no to the Constitutional treaty of the EU was accepted, but the project restarted and resulted in the (somewhat weaker and legally more complex but less strong) Lisbon treaty. It was, however, not just repeating the votes, the situation or the arguments have also changed, as explained in http://blogs.lse.ac.uk/europpblog/2015/10/19/asking-the-public-twice-why-do-voters-change-their-minds-in-second-referendums-on-eu-treaties/
There are two questions lingering: Will the Brexit vote also be repeated? What will happen to the TTIP? The latter question may be irrelevant, given that the TTIP faces much more resistance and that enthusiasm for it may fade in the U.S., too, if not already faded - and neither of the two presidential candidates is eager on it. No question that with Trump, we may bury it entirely but Clinton also treads carefully on it.