Was forced out of PhD for academic/health reasons, need advice on what to do next I was accepted into a PhD in maths at a fairly highly ranked school in 2017. My supervisor was known for being quite demanding, but I wanted this because I wanted to push myself, and he is quite well known in the field I was interested in, which is algebraic geometry. 

During the first year I was doing background work and developed my maths up to the point where I could start actually doing research. This involved going through textbooks and exercises and generally learning maths at a high level. Each week he was unhappy with my work, and would find holes in the proofs and logic, and holes in my understanding. After this happened over months, he began to suggest that maybe maths wasn't for me. Eventually he basically explicitly said this, and said that I wasn't understanding the material and wasn't able to think mathematically. He suggested that I drop out and "do something else with my life". 

The other issue here is that I was suffering from depression, and was fairly burned out from my undergrad, and I blame that in large part for not being able to study efficiently and think clearly. I did end up leaving the program late 2018, and I got a medical certificate to document the depression. 

The thing is, I am determined to succeed. I know for a fact that a PhD in maths is what I want to do, and I am not willing to give up on that. I am certain I have the ability, and am putting my failure down to the above mentioned issues. I am still doing maths every day to keep my skill level up and increase my understanding. At some point I want to reenter a PhD program. That is where my question comes in. 

What is the best way to get back into a PhD? How much will my past dismissal (technically I left voluntarily) affect my chances? Given that my supervisor has said flat out that he doesn't think I am cut out for maths research, how would I go about getting an academic reference for any future application? Any other advice is appreciated.
If you want to continue at the same school I'd start by going to talk to the administrators in your department, hopefully as a PhD student they will be familiar with you and your situation. Ask about your options to continue your studies, and possibly seek out a new supervisor.

I'd also make a list of other schools you'd be interested in attending, and find faculty there with similar research interests, ideally you could try setting up a meeting to discuss your shared interests and ask them if they might be willing to supervise you or if they have any projects that might be a good fit for you as a PhD student.