How do theorems arise? I am reading complex analysis where I have come across Maximum Modulus Principle which states that if an analytic function $f$ assumes its maximum in a point of the domain $S$ then $f$ is constant there.
I dont understand how do people rather mathematicians come out with  such a principle or lemma or theorem whatever you say that serve as a path breaking work for many problems to solve.
Is the problem in my study procedure that I dont see such a theorem coming or is it really a theorem from out of the box.
Sometimes I really do feel frustrated as I come across many theorems where I dont get a feel for the theorem and I dont get an idea from where to start its proof as I am not sure why the statement is true.Also it makes me feel that I should quit mathematics as nothing has still not come out of my head like these theorems but I am afraid to do so as it is the only thing I am capable of doing i.e reading and understanding mathematics
Please do share your thoughts whether it is the case for most of you or a successful mathematician is the one who has some crazy ideas which help them in coming up with such lemmas.
Thank You
 A: One must remember that you don't necessarily just write a theorem and then attempt to prove or disprove it. Most of the time (in my experience) I find myself working in some direction and once I find some result that I think is significant then it becomes a lemma/theorem of the work depending on what purpose it serves. So maybe to get a feel for the theorem you need to know the context in which it was established and the proof. The original paper which contains the theorem will be the best place to get this intuitive feel. 
A: Mathematics starts with curiousity. For example, once there was Fermat who thought that $x^n+y^n=z^n$ no integer solutions had, and people got curious, wanted to proof it.
If you think that something is true, you may first want to look for trivial counterexamples. Then you can look for heuristic arguments and conditions for counterexamples. Then you can know enough to start the proof. At least that is the proces I go through when I want to proof a theorem.
It is also the case that the first proof is not always the most elegant. If a theorem takes hundreds of pages to proof, I can indeed imagine that you can't really get through it. But then start thinking of the consequences of the theorem not being true. Then you might get the intuition. 
