LL.B law undergraduate degrees 'with honours' are 'classified' like all other UK undergraduate degrees, in the terms you state. Generally, a 1st is an overall mark of 70% or more, 2.1= 60%, 2.2 = 50% and 3rd is 40%. Below a third class, often the university will award an 'Ordinary degree' rather than one 'with honours'. This is effectively a fail. It is possible to do so badly as to not even warrant the award of an Ordinary and fail outright, though this is uncommon. All universities differ on how your final mark is composed: at my university, it's all on the final year, but most include marks in the second and 3rd year.
As for how do you get them: just work. The harder you work, the better you will do. Though a 1st usually requires demonstration of original thought, whereas a 3rd would require elementary knowledge of the basic, core material.