When drafting a writ, you typically have to raise one of the following issues/constitutional errors (and provide supporting facts) to succeed:
you were convicted under a law that is unconstitutional,
you did not have a competent lawyer (or no lawyer was provided),
there were instances of prosecutorial misconduct,
you were incompetent to stand trial,
false evidence,
new evidence was discovered showing your innocence,
there have been changes in the law since you were convicted,and
you suffer from unsafe or challenging conditions of confinement.
Habeas corpus writs can include supporting information, such as affidavits (declarations made under penalty of perjury). Plus the court may hold an evidentiary hearing on the writ.