In this version, a PS has been added.
Generally speaking, the answer to the question is principally "journal-dependent" and "editor-dependent". A journal may have a policy of demanding a referee report within $x$ months (where $x$ usually, but not always, varies between 2 to 6 months in my experience), but this policy may not be faithfully implemented by an editor who is not sufficiently strict or conscientious.
Other factors that can considerably delay the refereeing process include:
(1) the length of the paper, and
(2) the "esoteric" nature of the paper (as viewed by the editor). In such cases it might take a while (e.g. several months) for the editor to find an appropriate expert who is willing to serve as a referee.
Based on the above considerations, my advice to young mathematicians is to explicitly ask the editor in charge of your paper for an approximate time-frame for the completion of the review process (ideally, shortly after the journal has acknowledged receipt of the paper). Then, if you have not heard back from the journal within the expected time-frame, make a (gentle) inquiry about the status of your paper to the editor.
PS. Some of the comments to my answer found the idea of contacting the editor to gain information about the time-frame of the refereeing process to be unrealistic and/or improper. My answer was not meant to ask authors to force editors into promises they may not be able to keep, or to encourage authors to pester editors. However, I wish to point out that an editor always has the option to offer a very general time-frame based on his/her own experience (e.g. "usually 6 to 12 months, but in the case of your paper it might be longer because of $x$, $y$, or $z$"). To conclude: those of use who have served as editors and referees know that once in a while some "nudging" is necessary, albeit with utmost politeness, and with sympathy to the thankless plight of both editors and referees.