Being dispersionless, flat bands on periodic lattices are solely characterized by their macroscopically degenerate eigenstates: compact localized states (CLSs) in real space and Bloch states in reciprocal space. Based on this property, this work presents a straightforward method to build flatband tight-binding models with short-range hoppings on any periodic lattice. The method consists in starting from a CLS and engineering families of Bloch Hamiltonians as quadratic (or linear) functions of the associated Bloch state. The resulting tight-binding models not only exhibit a flat band, but also multifold quadratic (or linear) band touching points (BTPs) whose number, location, and degeneracy can be controlled to a large extent. Quadratic flat-band models are ubiquitous: they can be built from any arbitrary CLS, on any lattice, in any dimension and with any number N ≥ 2 of bands. Linear flat-band models are rarer: they require N ≥ 3 and can only be built from CLSs that fulfill certain compatibility relations with the underlying lattice. Most flat-band models from the literature can be classified according to this scheme: Mielke's and Tasaki's models belong to the quadratic class, while the Lieb, dice and breathing Kagome models belong to the linear class. Many novel flat-band models are introduced, among which an N = 4 bilayer honeycomb model with fourfold quadratic BTPs, an N = 5 dice model with fivefold linear BTPs, and an N = 3 Kagome model with BTPs that can be smoothly tuned from linear to quadratic.