When you die, DMT gets released in your brain. DMT can dilate your experience of time. In the instant that you pass from life to death, you experience that moment as if it were temporally infinite.
Heaven is an infinite good DMT trip. Hell is an infinite bad DMT trip.
Whether you have a good or a bad trip depends on your “set and setting“—i.e., your mindset and your surrounding environment—at the time of your death.
It’s possible that you could have a good enough mindset at the time of your death to overcompensate for a bad surrounding environment. One who wishes to go to heaven might spend their life trying to adopt a good mindset before the time of their death.