Is it ethical to post (part of) my research question on the internet? I do research in math. A lot of times, I get stuck. I wonder if it's considered ethical to post questions on which I get stuck on internet sites, for example Math Overflow or Math Stackexchange. 

If the question is just a small step or something already well-known, it is probably a waste of time to reinvent the wheel myself (and I don't get credit for doing so.) On the other hand, if it turns out to be a crucial step, then I could potentially be dishonest if someone on the internet solves it and I claim it's my own work. Sometimes it's not easy to tell beforehand which case the question will fall into.
Posting questions is ethical, the issue is with appropriate credit and potential collaboration. I would say that  most answers will be directions to published work that covers your question, if the question is about problems already solved. In this case, you just have to reference the books or papers that you used. 

If it turns out to be an open question, it probably won't be answered in a simple post on internet sites. In this case, in the best scenario, you could find people that will collaborate with you in a more permanent way, till you both solve the issue and, eventually, publish a paper.