  We formulate a refinement of SU(N) Chern-Simons theory on a three-manifold
via the refined topological string and the (2,0) theory on N M5 branes. The
refined Chern-Simons theory is defined on any three-manifold with a semi-free
circle action. We give an explicit solution of the theory, in terms of a
one-parameter refinement of the S and T matrices of Chern-Simons theory,
related to the theory of Macdonald polynomials. The ordinary and refined
Chern-Simons theory are similar in many ways; for example, the Verlinde formula
holds in both. We obtain new topological invariants of Seifert three-manifolds
and torus knots inside them. We conjecture that the knot invariants we compute
are the Poincare polynomials of the sl(n) knot homology theory. The latter
includes the Khovanov-Rozansky knot homology, as a special case. The conjecture
passes a number of nontrivial checks. We show that, for a large number of torus
knots colored with the fundamental representation of SU(N), our knot invariants
agree with the Poincare polynomials of Khovanov-Rozansky homology. As a
byproduct, we show that our theory on S^3 has a large-N dual which is the
refined topological string on X=O(-1)+O(-1)->P^1; this supports the conjecture
by Gukov, Schwarz and Vafa relating the spectrum of BPS states on X to sl(n)
knot homology. We also provide a matrix model description of some amplitudes of
the refined Chern-Simons theory on S^3.
