not sleeping is one symptom of bipolar illness. racing thoughts or speech is another. if you think you have bipolar disorder, a psychiatrist would be your best bet for answers.
i used to have low self-esteem when i practiced medicine. when i had no job, i learned that all people are equal and have worth based on just being human. i took this to heart and accepted that i may never have good social skills, but i am still a worthwhile person. my low self-esteem came from having a demanding dad. i had to learn to value my own opinion of myself above his opinion of me. a book that helped me is "the self-esteem companion" by mckay, fanning et al.