'Fair and square' is a adverbial set phrase meaning 'absolutely fairly'.
The main reason we use this phrase is because the rhyme and rhythm sound good. The rhyming words 'and square' give force and emphasis to the word 'fair'. The word 'square' has very little literal meaning here, apart from the associations with being a shape with clear and obvious lines, suggesting honesty and equality. We have other expressions with 'square' which suggest fairness - for example, a 'square deal' is a fair and honest deal.