  Flatbands (FBs) are dispersionless energy bands in the single-particle
spectrum of a translational invariant tight-binding network. The FBs occur due
to destructive interference, resulting in macroscopically degenerate
eigenstates living in a finite number of unit cells, which are called compact
localized states (CLSs). Such macroscopic degeneracy is in general highly
sensitive to perturbations, such that even slight perturbation lifts the
degeneracy and leads to various interesting physical phenomena.
  In this thesis, we develop an approach to identify and construct FB
Hamiltonians in 1D, 2D Hermitian, and 1D non-Hermitian systems. First, we
introduce a systematic classification of FB lattices by their CLS properties,
and propose a scheme to generate tight-binding Hamiltonians having FBs with
given CLS properties---a FB generator. Applying this FB generator to a 1D
system, we identify all possible FB Hamiltonians of 1D lattices with arbitrary
numbers of bands and CLS sizes. Extending the 1D approach, we establish a FB
generator for 2D FB Hamiltonians that have CLSs occupying a maximum of four
unit cells in a $2\times2$ plaquette. Employing this approach in the
non-Hermitiaon regime, we realize a FB generator for a 1D non-Hermitian lattice
with two bands. Ultimately, we apply our methods to propose a tight-binding
model that explains the spectral properties of a microwave photonic crystal.
  Our results and methods in this thesis further our understanding of the
properties of FB lattices and their CLSs, provide more flexibility to design FB
lattices in experiments, and open new avenues for future research.
