Clarification To other Hindus:- I will speak here mostly from the point of view of the Visista-Advaita theology as rebirth is easier to understand from the pov.
I will be using the Gita to explain the relationship between rebirth, heaven and hell in Hindu theology.
First let us look at happens to the beings who are virtuous without becoming fully enlightened.
Those who know the three Vedas (scriptures),
the soma drinkers, those whose evils are
cleansed,
Worship Me with sacrifices and seek
to go to heaven.
They, attaining the pure world of the
Lord of the gods,
Enjoy in heaven the gods' celestial
pleasures .
Having enjoyed the vast world of
heaven,
They enter the world of mortals when
their merit is exhausted.
Thus confonning to the law of the
three Vedas,
Desiring enjoyments, they obtain
the state of going and returning.
Those who are devoted to the gods go
to the gods;
Those who are devoted to the ancestors
go the the ancestors;
Those who are devoted to the spirits
go to the spirits;
Here the thought is that people who have been good and pious have done a finite amount of good through their actions and hence, according to justice, receive a finite amount of reward in heavens and closeness with the gods (in Islams these would appx be angelic forces that oversee the world) before returning back to the mortal further for further development of their character and wisdom.
The nature of birth differs based on the character of the person, which in turn is determined by his actions. It is possible to progress or regress based on the free willed choices and actions one does. So an evil person will be reborn in conditions of greater ignorance, delusion and suffering due to his actions. The mediocre will stay mediocre.
When an embodied being goes to
dissolution (death)
Under the dominance of sattva (virtue),
Then he attains the stainless worlds (heavens)
Of those who know the highest.
He who goes to dissolution (death)
when rajas (selfish action) is dominant,
Is reborn among those attached to
action;
Likewise, dissolved (dying) when
tamas (delusion and evil) is dominant,
He is reborn from the wombs of the
deluded.
From sattva knowledge is bom,
And from rajas desire;
Negligence and delusion arise
From tamas, and ignorance too.
Those established in sattva go upward;
The rajasic stay in the middle;
The tamasic, established in the lowestquality,
Go downward.
But this does not mean that the cycle is endless for a being. For there is a state of wisdom that is higher than virtue and piety (sattva)
When the seer perceives
No doer other than the three qualities (sattva-rajas-tamas),
And knows that which is higher than the qualities,
He attains My being.
When an embodied being transcends
These three qualities, which are
the source of the body,
Released from birth, death, old age, and pain,
He attains immortality.
To whom pain and pleasure are equal,
who dwells solely in the (Great) Self (Atman),
To whom a clod, a stone, and gold are the same,
To whom the loved and the unloved
are alike, who is steadfast,
To whom blame and praise of himself
are alike.
To whom honor and dishonor are
equal,
Dispassionate toward the side of
friend or foe,
Renouncing all (goal-seeking) undertakings
He is said to transcend the qualities.
And he who serves Me
With the yoga of unswerving devotion,
Transcending these qualities,
Is ready for absorption in Brahman.
So this is the overall system according to the Gita in brief.