Suicidal ideation is a process starting with falling short of expectations then blaming yourself for the shortfall. You start incorrectly rationalizing reasons why everything is your fault and how nothing can get better. Negativity permeates every thought. Your world breaks down into tiny logical blocks and you rationalize why everything is hopeless.
The only way out is to break the chain of elevating mental isolation and negativity. It's easier to stop it in the nascent stages. Try not to blame yourself. The world is a big place and we have so much to do.