Chern-Simons Theory in 3D
Answering the first question. The Chern-Simons functional expressed in terms of the vector potential $A$:
$$S(A) = \frac{k}{8 \pi^2} \int_M tr(A \wedge dA + \frac{2}{3} A \wedge A \wedge A )$$
is well defined only for a trivial principal bundle, because in this case the gauge connection is a Lie algebra one form over $M$. When $M$ is an oriented three manifold and the gauge group $G$ is compact connected and simply connected, then every $G-$ bundle over $M$ is trivializable (see, for example the following article by D. Freed)
The case when the principal bundle is not trivial (for example when the above restrictions on the gauge group are not satisfied) was treated by Dijgraaf and Witten , using the standard construction by Witten: One can choose a 4-manifold $B$ such that $M$ is its boundary. The CS action is defined:
$$S(A) = \frac{k}{8 \pi^2} \int_B tr(F \wedge F)$$
This action is the proper definition of the CS action for the following two reasons
It reduces to the usual CS action when the bundle is trivial (Using Stoke's theorem).
If k is an integer, the general form is independent modulo 1 of the extension $B$ of $M$.
For the first question, the Chern-Simons action is a functional of the Lie-algebra valued one form $A$, which in general is defined locally. For example, one can consider the $U(1)$ bundle over $S^{2}$. A non-trivial bundle exists if there is a Dirac magnetic monopole inside the sphere. In such a case, the gauge potential $A$ is not globally well-defined. Thus, it doesn't make any sense to write down the functional integral
$$\int_{M}\mathrm{Tr}(A\wedge dA+\frac{2}{3}A\wedge A\wedge A),$$
because one has to extend the definition of the gauge field $A$ throughout the entire manifold, which is impossible.
To solve this problem, one has to find a way to glue $A$ field at different patches of $M$. This is explained here by Urs Schreiber.
For the second question, I suppose you meant "framing" of a three dimensionsal manifold. It roughly measures how much the tangent bundle of a three dimensional manifold is twisted. Any oriented three dimensional manifold is parallelizable, but there is no canonical way to trivialize its tangent bundle. A framing of a three dimensional manifold is a trivialization of its tangent bundle. In Witten's paper, the counter-term in the path-integral of Chern-Simons theory is a gravitational Chern-Simons action
$$S[\omega]=\int_{M}(\omega\wedge d\omega+\frac{2}{3}\omega\wedge\omega\wedge\omega)$$
where $\omega$ is the connection on its spin bundle (I don't understand why it is on spin bundle, but not defined on tangent bundle). But this action has an ambiguity because under a $\mathrm{SPIN}(3)$ action (I don't know why it cannot be $\mathrm{SPIN}(2,1)$), say $g$,
$$\omega\rightarrow g^{-1}dg+g^{-1}\omega g$$
then the gravitational action goes to
$$S[\omega]\rightarrow\int_{M}(\omega\wedge d\omega+\frac{2}{3}\omega\wedge\omega\wedge\omega)-\frac{1}{3}\int_{M}\mathrm{Tr}(g^{-1}dg\wedge g^{-1}dg\wedge g^{-1}dg)$$
The last term is the Wess-Zumino Witten term, which is an integer up to some normalization constant, because it belongs to the integral cohomology $H^{3}(SU(2),\mathbb{Z})$. This arbitrary integer is the framing anomaly.
(There is a mathematical theorem, showing that for any simply, compact, simply connected Lie group $G$, the integral cohomology $H^{3}(G,\mathbb{Z})$ is generated by $\mathrm{Tr}(g^{-1}dg\wedge g^{-1}dg\wedge g^{-1}dg)$. The proof can be found here and here. If $g\in\mathrm{SPIN}(2,1)$, then I am not sure if the last term is still integral cohomology.)