C section

At how many weeks do the doctors decide if you have to have a c section and for what reasons would you need one???