To some extent this depends on the nature of your result, but the principle I generally follow is this:

State your result as soon as possible, subject to the constraint that when readers arrive at the statement of your result, they will have some idea of what question you are answering and why.

For example, if you're proving a conjecture that is easy to state, or is likely to be known already to anyone who is interested in your paper, then you can pretty much launch right in and say that your paper proves so-and-so's conjecture, and state the conjecture.

If you're proving a conjecture that isn't so well known or easy to state, then I'd start by saying that you're proving so-and-so's conjecture. Then give the minimum necessary background to understand the statement of the conjecture and why it was made. After that you can give further context and motivation if it seems appropriate.

If you're not proving someone's conjecture but are proving something that bears a simple relationship to an existing result (e.g., it's the converse of some known theorem, or a generalization), then again I would start by saying that you're (for example) generalizing so-and-so's result. Then state the other result, and state your result. Further context and motivation can come afterwards if appropriate.

If your result does not fall neatly into one of these categories but is more of a general theoretical advance, then it may be trickier to decide how much background to give before stating your result. I usually lean towards giving as little background as possible, because it's easy to make the mistake of giving too much background, and losing the interest of the reader. As a first draft, try stating your result without any context, and then ask yourself if your typical reader would react by thinking, "Why on earth would anyone prove such a result?" If so, then back up and give just enough context to pre-empt such a question.

One general comment is that if your result is difficult to state precisely because the precise statement is very complicated, then see if you can come up with a simplified version, even if you have to be slightly vague or have to weaken your result to do so. This will allow you to state your result sooner, in accordance with the highlighted principle above. The more precise version of your theorem can come later, after the reader has decided that it's of sufficient interest.

introducethem for non-expert readers. Bad things tend to come out when these two are mixed together. $\endgroup$ – darij grinberg Nov 10 '16 at 16:33