These are very broad questions and there are certainly no simple answers. New research papers discussing specific aspects of such questions appear every day, perhaps every hour. There are dozens of journals that deal with aspects of these questions, plus many textbooks and conferences.
An interest in these and similarly broad questions might motivate undertaking a degree program in the related topics. It will soon become apparent that there are no simple answers.
This is a bit like asking "what causes illness and how can illness be prevented". Except this is much more complicated because it involves not just a few species living in a few circumstances.