We prove that that the homotopy type of the path connected component of the identity in the contactomorphism group is characterized by the homotopy type of the diffeomorphism group plus some data provided by the topology of the formal contactomorphism space. As a consequence, we show that every connected component of the space of Legendrian long knots in $R^3$ has the homotopy type of the corresponding smooth long knot space. This implies that any connected component of the space of Legendrian embeddings in $NS^3$ is homotopy equivalent to the space $K(G,1)timesU(2)$, with $G$ computed by A. Hatcher and R. Budney. Similar statements are proven for Legendrian embeddings in $R^3$ and for transverse embeddings in $NS^3$. Finally, we compute the homotopy type of the contactomorphisms of several tight $3$-folds: $NS^1 times NS^2$, Legendrian fibrations over compact orientable surfaces and finite quotients of the standard $3$-sphere. In fact, the computations show that the method works whenever we have knowledge of the topology of the diffeomorphism group. We prove several statements on the way that have interest by themselves: the computation of the homotopy groups of the space of non-parametrized Legendrians, a multiparametric convex surface theory, a characterization of formal Legendrian simplicity in terms of the space of tight contact structures on the complement of a Legendrian, the existence of common trivializations for multi-parametric families of tight $R^3$, etc.