The requirements for initiating the act are a little different, depending on the process being called into effect, but it appears you are inquiring about involuntary examination, which is the initial step for most, and the step most often questioned.
Involuntary examination may begin when:
a person signing an affidavit outlines why another person qualifies for such an examination; a judge then determines whether and when such an examination should begin
a law enforcement officer sees a person he or she believes should be examined and takes that person to a facility, or
a doctor or other health care provider determines a person should be examined, and a law enforcement officer then takes him or her to a facility for examination.