Using a known result without a specific reference
As a person who is very precise, I have thought about this question quite a bit (and discussed it with many other mathematicians, junior and senior). Some observations:
- You can never give references for everything you use. If you give a reference that an arbitrary base change of a flat map is flat, do you also give a reference that arbitrary base change exists? Etc.
- Thus, you have to draw the line somewhere. Where you draw this line is to some extent up to you; I have certainly seen different authors with quite different approaches to this. General conventions may also vary from field to field; e.g. I have often had the impression that post-Grothendieck algebraic geometry is more precise with references than some other areas (but maybe this is only because I understand the material better!).
- I could imagine that the referees of your (future?) papers might have opinions on it as well. In case of disagreement, your own opinion might not matter so much anyway.
- From taking some mandatory research compliance module at some point, I learned that fields that are not mathematics, especially some of the humanities, are much more precise about attribution of ideas in referencing.
Here is a concrete example of the latter:
Example. Let's say — for the sake of argument — that you are an algebraic geometer who wants to use a relative version of Chow's lemma. Some academics would argue (and I think they have a point) that you then have to cite Chow's original article. It seems that nobody in mathematics does this (probably for a good reason!).
A possible compromise could be to cite EGA, e.g. because it might be the first source in which the precise version that you need occurs with complete proof. Or you can cite the Stacks project for the same result, because you think this resource is more accessible to the average reader than EGA. Or you can decide that Chow's lemma is sufficiently well-known that it does not need a reference at all. An algebraic geometer would probably do the latter, whereas a non-expert would be more likely to give a reference.
This is a kind of easy example where the result really is well-known. It gets trickier when you use more specialised knowledge. For example, I found out (by giving talks at multiple universities) that certain (easy) results that are well-known to birational geometers may be unfamiliar to arithmetic geometers (and vice versa).
Closing remark. It's a judgement call. Asking people for advice (as you do here) is definitely an ok thing to do, but eventually you will figure out for yourself what your citation protocol is.
I am personally of the opinion that it can't hurt to err on the safe side. An in-line citation only takes up a few characters, and does not significantly disrupt the flow of the argument. But my own style will be more precise than most people's, so you don't have to do what I do. (And I have not yet dealt with referees, which I anticipate will have a significant impact on my maths writing overall.)
As per John Pardon's suggestion: there are a lot of other things to take into account when citing other work. For example, citing an entire book might not be a great idea; in general you want your references to be as precise as possible. A great video about this and many other bad writing habits (more than just referencing) is Serre's How to write mathematics badly.
Citing works available online (preferably for free) is the most convenient for the reader. However, I personally think sometimes the "correct" reference is not always the one that is the easiest to find. In principle most working mathematicians should have access to journals that are not available online (e.g. Astérisque) through their libraries. But there is definitely something to be said for just citing the most convenient source, so this is another judgement call.
My advise: cite everything which you do not prove in your paper, and which is not included in the standard undergraduate and graduate textbooks in the subject.
It absolutely does not matter whether the source passed a peer review or not. The crucial criterion for a citable source is that it must be AVAILABLE. (Published, posted in the internet). If you suspect that the thing is in EGA, search in EGA. (I suppose that EGA is not a standard graduate text book, otherwise you would have no difficulty searching:-)
What is "common knowledge" and what is not strongly depends on the set of people that you consider. If you want your paper to be read by people, try to make it accessible to maximally broad set. On my opinion, a typical reader of a research paper is a graduate student in the same broad area.
My general rule of thumb is to ask myself the following questions:
(1) If I pretend that my paper was written by someone else, and I hadn't seen it before, and I want to verify its accuracy, would it be helpful to have a reference for the result?
(2) Could I reproduce said result without a reference? [If not, I should definitely give a reference.]
(3) Would I expect a sufficiently educated graduate student be able to reproduce the result if I gave it as an exercise? [If so, it's probably okay to leave out, or give a short sketch of the proof if it might help.]
(4) Is it a result that I think is nice, and should be more well-known?
(5) Is the original prover likely to be interested in my paper?
Of course, you can just ask your friends in the field whether or not they'd agree with you that it is folk-lore, well-known, etc...
Some referees are very particular about these sorts of things. In those cases, you just add references as they suggest.
Citing exercises is, in my opinion, usually a bad idea unless the exercise comes with a specific solution. So, for instance, I've cited T.Y. Lam's "Exercise" books quite a lot. I've also written a paper giving a counter-example to the (first two!) exercises in Cohn's "Free Rings and Their Relations".
Citing the stacks project is fine, although as with many things on the internet, it could eventually disappear, get updated, etc... You have to take care to give the date of citation, etc...