It is easy to find out which rectangular m vertex by n vertex grids have a Hamiltonian path from one corner to another using a checkerboard argument. However, it is quite difficult in general to count the total number of such paths. In this paper we give generating function answers for grids with fixed m for m = 1, 2, 3, 4, 5.
Collins, K. L., & Krompart, L. B. (1997). The number of Hamiltonian paths in a rectangular grid. Discrete Mathematics, 169(1–3), 29–38. https://doi.org/10.1016/0012-365X(95)00330-Y