I had an interview for a position in a math department. At the end of interview, is it necessary to ask them about the approximate time of releasing result?
It's not necessary to ask this question, but it's a perfectly normal to do so. I don't see any negative repercussions from asking. The information is useful if you are having another interview or waiting to hear the outcome of another application, as it can help you work out when you will have to make a decision on which to accept (if you get another offer). The interviewers may even ask you if you have any such deadlines.
I also find it helpful to ask this type of question because it helps me manage the stress of waiting for a result: if I know I won't find out for two weeks, then I won't be checking my emails daily expecting to hear. You may find the information helpful in the same way.