Context : Aims : We aim to study the rotating and expanding gas in the Red Rectangle , which is a well known object that recently left the asymptotic giant branch ( AGB ) phase . We analyze the properties of both components and the relation between them . Rotating disks have been very elusive in post-AGB nebulae , in which gas is almost always found to be in expansion . Methods : We present new high-quality ALMA observations of C ^ { 17 } O J =6 - 5 and H ^ { 13 } CN J =4 - 3 line emission and results from a new reduction of already published ^ { 13 } CO J =3 - 2 data . A detailed model fitting of all the molecular line data , including previous maps and single-dish observations of lines of CO , CII , and CI , was performed using a sophisticated code that includes an accurate nonlocal treatment of radiative transfer in 2D . These observations ( of low- and high-opacity lines requiring various degrees of excitation ) and the corresponding modeling allowed us to deepen the analysis of the nebular properties . We also stress the uncertainties , particularly in the determination of the boundaries of the CO-rich gas and some properties of the outflow . Results : We confirm the presence of a rotating equatorial disk and an outflow , which is mainly formed of gas leaving the disk . The mass of the disk is \sim 0.01 M _ { \mbox { \sun } } , and that of the CO-rich outflow is around ten times smaller . High temperatures of \stackrel { \sf > } { \scriptstyle \sf \sim } 100 K are derived for most components . From comparison of the mass values , we roughly estimate the lifetime of the rotating disk , which is found to be of about 10000 yr . Taking data of a few other post-AGB composite nebulae into account , we find that the lifetimes of disks around post-AGB stars typically range between 5000 and more than 20000 yr . The angular momentum of the disk is found to be high , \sim 9 M _ { \mbox { \sun } } AU km s ^ { -1 } , which is comparable to that of the stellar system at present . Our observations of H ^ { 13 } CN show a particularly wide velocity dispersion and indicate that this molecule is only abundant in the inner Keplerian disk , at \stackrel { \sf < } { \scriptstyle \sf \sim } 60 AU from the stellar system . We suggest that HCN is formed in a dense photodissociation region ( PDR ) due to the UV excess known to be produced by the stellar system , following chemical mechanisms that are well established for interstellar medium PDRs and disks orbiting young stars . We further suggest that this UV excess could lead to an efficient formation and excitation of PAHs and other C-bearing macromolecules , whose emission is very intense in the optical counterpart . Conclusions :