Which means whatever entity one thinks of at the time of death, he
attains the state of that very entity.
It is not very easy to die without thinking about anything. It doesn't naturally happen. This is why Yoga needs to be practiced.
- Now concentration is explained.
- Yoga is restraining the mind-stuff (Chitta) from taking various forms (Vrttis)
~ Yoga Sutras of Patanjali Chapter 1
When you can't restrain your mind in a simple painless meditation for 2 minutes, restraining the same during a painful death is highly difficult. That's why we practice - yoga - equanimity of mind in various situations of life - through karma yog, bhakti yog and gyan yog. The three yogas help to purify the mind so that it calms down and specially during the time of death - prevents taking various vrittis based on attachment and pain and break the cycle of death and birth.