It uses cubic Bézier curves to connect the points of your plot, with the two supports for each point calculated using a relatively simple algorithm that takes the previous and next point into account.
The support points for the Bézier curves are calculated so that the tangent through one point is is parallel to a line connecting the previous and the next point:
In order to determine the control points of the curve at the point y, the handler computes the vector z − x and scales it by the tension factor. Let us call the resulting vector s. Then y + s and y − s will be the control points around y. The first control point at the beginning of the curve will be the beginning itself, once more; likewise the last control point is the end itself.
The same approach is taken with smooth cycle.
Code
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing, shapes.misc}
\tikzset{show curve controls/.style={decoration={show path construction,curveto code={
\draw[blue,dashed](\tikzinputsegmentfirst)--(\tikzinputsegmentsupporta)node[at end,cross out,draw,solid,red,inner sep=2pt]{};
\draw[blue,dashed](\tikzinputsegmentsupportb)--(\tikzinputsegmentlast)node[at start,cross out,draw,solid,red,inner sep=2pt]{};}},decorate}}
\begin{document}
\tikz[mark=*, mark size=1pt]
\foreach[count=\j] \cycle in {, \space cycle}
\foreach[count=\i] \tension in {.5, 1, 1.5, 2}
\draw[shift={(\j*5cm,-\i*2cm)}, postaction=show curve controls]
plot[tension=\tension, smooth\cycle] coordinates {(0,0)(1,1)(2,.5)(3,1)}
node[above] {\tension}
(0,0) edge[densely dotted] (2,.5)
(1,1) edge[densely dotted] (3,1);
\end{document}
Output

\draw plot[id=sin,smooth] function{sin(x)};. – N.N. Jul 08 '11 at 10:34\draw plotfunction to do the actual plotting. – Jake Jul 08 '11 at 10:44