A geometric approach to permutation polynomials over a finite field