How competitive are places for PhD positions in mathematics? I am a master student in mathematics at a university in the Netherlands and am currently applying for PhD positions as I will be graduating soon. Thus far I have applied for about ten positions (in the Netherlands, Germany, Denmark, Sweden, Switzerland, etcetera) and although I am still waiting on some of my applications, I have been rejected without interview from the ones I have heard back from (which is the majority).

In brief conversations I have had with academics on this issue, they have generally hinted (albeit rather vaguely) that competition is not so high (say, compared with industry) and that I should be hopeful of landing  a position. This is in spite of the fact that my grades are quite average and the feedback I received from one failed application was that my grades were too low. My academic advisor, however, advised me that the quality of my thesis (which I am currently writing) was of more importance and downplayed the importance of grades due to how they differ from country to country, university to university (among other reasons).

The problem seems to be that positions are seldom advertised and even if only twenty percent of graduates wish to pursue a doctoral position, that means that there are still a lot of people vying for say only one position.

I was wondering what the general consensus on this was and if I should maybe lower my expectations of getting a doctoral position if it is say only intended for the "best of the best"?
I don't know if my opinion is representative of a general consensus, but I would look for candidates who fit well for the program, in particular those who fit well with the area(s) I'd like to supervise and work on. Research is so broad, that a candidate can not be "best of the best" in all areas simultaneously. If you are trying to impress people and present yourself as the best of the best candidate, you end up writing a generic and vague statement, full of unjustified self-praise with a little evidence. Some of applications I deal with don't even have the University name in their statements (e.g. I apply to your University because...) - guess what happens with them?

I suggest you to really do your homework, research a few Departments you are really interested in, choose the place (or two or three) which suits you and then write your application very specifically for each place, to demonstrate how well your interests and skill set match their interests and research programs. It's all about the right match, not being a jack of all trades.