Data-Driven System Analysis Using The Koopman Operator: Eigenfunctions, Invariant Subspaces, And Accuracy Bounds