After reviewing some elementary properties of RNA, we discuss how statistical mechanics can be used to determine the secondary structure of RNA. We first show how to parametrize the free energy of secondary structures. Given such a parametrization, we review the algorithms used for the prediction of secondary structures without pseudoknots. To include pseudoknots, inspired by matrix field theory, we propose aclassification of RNA structures in terms of their topological genii. We modify the free energy parametrization so as to include a penalty proportional to the genus of the RNA structure, and we present two algorithms to efficiently predict RNA structures with pseudoknots.