What are the ethics of getting help from online forums? As an engineer, sometimes in my research I come across a mathematical problem that either is beyond my mathematical skills, or I know that someone, somewhere must have seen something like it before and can point me in the right direction, hence saving me time.

Asking on math.stackexchange often does the trick, but I wonder what the ethics involved are. For instance, if someone provides a complete answer, and the result turns out to be integral to the paper, should I offer them authorship? 

PS: I'm not talking about a result that is novel in itself - i.e. it would not be considered as a contribution to mathematics. The result will be an application of standard mathematics to a particular engineering problem.
Asking on math.stackexchange often does the trick, but I wonder what the ethics involved are. For instance, if someone provides a complete answer, and the result turns out to be integral to the paper, should I offer them authorship? 


If someone else made an integral contribution to your work, it seems appropriate to offer them coauthorship, yes.  You go on to say:


  I'm not talking about a result that is novel in itself - i.e. it would not be considered as a contribution to mathematics. The result will be an application of standard mathematics to a particular engineering problem.


I see what you're getting at, but still: if you did not have the knowledge to write the paper, then asked someone for help, then based on their help you can write the paper, then it seems that they deserve to be offered coauthorship even if what they provided was from the perspective of their discipline completely routine and well-known.  

One example that springs to mind is the Hardy-Weinberg Principle: this is a famous (and, in my understanding, rather important) law of genetics whose mathematical content really does seem to amount to: if p+q = 1, then p^2+2pq + q^2 = 1.  The history of this is not what I had assumed it to be: it is not a collaboration between Hardy and Weinberg (Weinberg was a German physician who had independently discovered the law at about the same time).  Rather Reginald Punnett was having trouble defending Mendelian genetics against an argument of Udny Yule that dominant alleles would weed out recessive ones and thus genotypic frequencies would not remain stable in the population.  Punnett brought this up to (the great analytic number theorist) G.H. Hardy who happened to be his cricket partner, who duly submitted a letter to the journal Science.  As the wikipedia article points out, Hardy makes his take on his "contribution" pretty clear, e.g. in the phrasing "a little mathematics of the multiplication-table type is enough to show...."  It is interesting that this is not called the "Hardy-Punnett Law" (though there are Punnett squares, which seem to my inexpert eye to be pretty much the same thing).  One striking thing about this example is that the mathematics here is really trivial: it is hard to imagine any mathematician (or engineer, etc.) who would not have been able to answer the question.

Of course, just because you offer someone coauthorship does not mean that they will take it.  Most mathematicians I know are not interested in being coauthors of papers in other disciplines for which their contribution was purely mathematical and is regarded by them as "trivial", "well-known" or both.  If someone declines coauthorship then it seems largely agreed upon that you can go on to write the paper by yourself and include a clear acknowledgement of their contribution.