Samskara carries two related senses in Indian thought, both from a root meaning to put together, refine or consecrate, and it is worth holding them apart.
In the psychological and karmic sense, samskaras are the latent impressions left in the mind by every act, thought and experience, grooves that dispose a person to repeat what they have already done. In Patanjali's Yoga Sutras they are the residues that generate vasanas, habitual tendencies, which produce the mental fluctuations that yoga exists to still. The cycle in which action leaves impressions, and impressions produce further action, is the mechanism by which karma perpetuates itself; and this is why liberation on the yogic account requires the burning up of accumulated residues and not merely the cessation of new acts. Buddhist Abhidharma uses the cognate sankhara for the fourth of the five aggregates, the volitional formations, and places it second among the twelve links of dependent origination, immediately after ignorance.
In the ritual sense, the samskaras are the life-cycle rites that consecrate the stages of a life. The Grhya Sutras and the later dharmasastra literature enumerate them, with counts ranging from twelve to forty; sixteen is the most commonly cited set, running from the rites of conception and pregnancy through birth, name-giving, first outing, first solid food and tonsure, to the upanayana or investiture with the sacred thread that begins Vedic study, the completion of studentship, marriage, and the funerary rites.
Two of these have carried disproportionate weight. Upanayana marked twice-born status and access to Vedic learning, and in the classical texts was restricted by class and to males, a restriction contested from the nineteenth century and rejected outright by reform movements such as the Arya Samaj, which restored the rite to women and to those excluded by birth. Marriage is the samskara that remains near-universal in practice, and for those classes for whom upanayana lapsed it functions as the principal consecration.
The two senses are connected rather than merely homonymous: the rites are understood to work on the person as refinements, leaving impressions of their own, so that the ritual sense is a deliberate application of the psychological one.