The Pali word Kamma (Karma in Sanskrit) literally means action or doing. The belief in karma and reincarnation was prevalent in India before the days of the Buddha. However, it was the Buddha who explained in detail and formulated the doctrine of Kamma and Rebirth as found in the ancient Buddhist texts.

Kamma determines the state into which a being is born. It the chief cause of inequalities in the world. Some are born into happy circumstances, with good health, wealth, mental and physical characteristics, while some others are born into abject misery.

According to the Buddha, Kamma is one of the universal laws that determine the state of existence of all sentient beings. There are four other natural laws (Niyamas*) that govern universal processes.
Therefore everything that happens in the world is not due to kamma.

Any kind of intentional action, whether mental, verbal or physical is regarded as Kamma. Inherent in kamma is the potentiality of producing its due effect, which operates in its own field without the intervention of any external, independent ruling agency. Kamma produces results (Kamma vipaka) which the doer has to experience. This is a reaction in accordance with the natural law of cause and effect.

Buddhism does not support the view that kamma is a law of 'moral justice' or 'reward and punishment', as there is no external agency that metes out justice. Neither it is to be regarded as 'sin', as sin is regarded as the breaking of God's commandments.
The Buddha said that it is only the actions that are performed with intention (volition) are regarded as kamma**.

Kamma may be categorised as wholesome, skilful (kusala) or unwholesome, unskilful (akusala) or neutral. It follows that wholesome kamma will produce a beneficial result and unwholesome kamma will produce a negative or detrimental effect on the doer of the deed. Neutral kamma will not produce an effect.
A kammic act is complete when intention, action and a result take place.
For example, a person may think about causing injury to someone. He or she may then act through the body to actually carry out the task. If there was only the intention, but no injury took place, there would be less kamma generated. In general, any intentional action through the body, speech or mind, which does harm to oneself and to others will be unwholesome kamma. Similarly, any intentional action that produces beneficial effect would produce wholesome kamma.

The result of a particular kammic action may manifest at any time, either in the present or a future life, when the appropriate conditions are present. Kamma operates in a complex and dynamic manner, the result of one action undergoing changes due to subsequent actions. The result of an unwholesome kamma may be lessened or neutralised altogether by wholesome kamma. Similarly, the result of an intense unwholesome kamma may manifest although the person affected normally leads a virtuous life. Therefore it is more appropriate to talk in terms of probability of a kamma vipaka (result).

Only particular types of serious Kamma (Annantariya kamma) such as harming a Buddha, killing an arahant (virtuous person), killing a parent will produce inescapable and detrimental results.

Only a Buddha has the wisdom to fully comprehend and predict the complex outcome of kamma.

The ancient texts describe some of the probable consequences of unwholesome kamma as follows:

Killing: shortness of life, ill health, frequent grief due to separation from loved ones, frequent fear.

Stealing: poverty, misery, disappointment, dependent livelihood.

Sexual misconduct: having many enemies, union with undesirable husbands and wives, birth as a eunuch.

Lying: being subject to abusive speech and vilification, untrustworthiness, a smelly mouth.

The ultimate goal of a Buddhist should not be to acquire wholesome kamma in order to be reborn in a better life, but to engage in activities that lead to the complete cessation of suffering, the realisation of Nibbana.

Rebirth

Even before the time of the Buddha, the belief was that the soul (atman) which was the permanent entity of a living being transmigrated after death to be reincarnated in a new life. This process of death and reincarnation went on indefinitely, until such time that the soul was purified by spiritual development to be re-absorbed into the creative force.

The Buddha said that one of the fundamental characteristics of existence is its transient nature (impermanence). All things are in a perpetual state of change and nothing exists permanently. This remarkable insight is confirmed by modern physics by observing the behaviour of matter at sub-atomic level, where the fundamental particles of matter are seen to exist only momentarily and disappear. The ever changing nature is particularly true of our bodies, where millions of cells die every minute and are replenished continuously.

A sentient being (this includes animals), according to Buddha, is an ever changing, interdependent process of mind and body (nama-rupa). Therefore a permanent soul cannot exist in this ever-changing mind-matter combination.

Absence of a permanent soul or entity (anatta) is one of the three fundamental characteristics of existence. Hence Buddhists use the term rebirth in preference to reincarnation, as there is no transmigration of a soul. Death is just one phase of this continuous cycle of existence, linking our present life and the next, and is a direct result of our accumulated kamma (see Wheel of Life).

The past accumulated kamma acts in a subtle way to condition the new life. A person who has acquired wholesome kamma may well be born into happy circumstances, enjoying good health, wealth and family connections. Although the inherited genes from parents play an important part in determining physical and some mental characteristics, kamma may be considered as the driving force. It may well be that rebirth to particular parents was the appropriate result of past kamma.

If there is no permanent soul, how does one life link to another? It is said to be due to the momentum of the accumulated kamma resulting in the continuation of the 'stream of consciousness'. Re-birth is simply a continuation of this process.
This is explained in terms of a famous simile of the flame, recorded in the Milinda Panha, a dialogue between Ven Nagasena and King Milinda: if one were to light a flame (oil lamp or a candle) from a flame already burning but about to go out, what has been passed on? Is the new flame the same as the old one or different?.

The texts describes the being reborn as 'Neither the same nor another' (na ca so na ca anno)

Using modern terminology, some might say rebirth is a result of an energy transfer from the existing life to the new. However one has to be cautious in using such terminology, as the term energy has a specific meaning in science. It may well be that consciousness and related phenomena such as rebirth and kamma cannot be explained in terms of the laws of classical physics applicable to the material universe as we understand them now.

The Buddha emphasised that birth as a human being is precious, and provides the best opportunity for highest development of the mind leading to the attainment of Nibbana.***

See the investigations and publications by the University of Virginia:
https://med.virginia.edu/perceptual-studies/publications/books/study-of-reincarnation/

Notes

* Niyamas
Utu Niyama: inorganic physical order - cause of weather, seasons etc
Bija Niyama: organic physical order - growth of plants, cells, genes etc
Kamma Niyama: volitional actions and the corresponding results
Dhamma Niyama: natural processes - Gravity and other natural phenomena
Citta Niyama: order of the mind and consciousness, psychic phenomena etc

**The Buddha said, "I declare, O Bhikkhus, that volition (cetanā) is Kamma. Having willed one acts by body, speech and thought.".

***According to the teachings, there are 31 planes of existence where beings exist in the universe. Human plane is just one of them. Planes of existence below human are classed as woeful states. Beings born into such planes are unable to aquire wholesome kamma due to the nature of their unhappy state. Therefore these beings may remain trapped in that plane until the unwholesome kamma that caused the birth is exhausted.

On the other hand, beings born into higher planes than human are said to enjoy blissful existence and thoughts of release from the cycle of existence are furthest from their minds.
The human plane provides a more balanced environment, beings experiencing both happiness as well as unhappiness. They are able to, if they wish and with right effort, enter the path to liberation.

See Q&A- kamma