The appraisal determines the market value of the home. Your lender will order the appraisal as part of the home buying process. If you are paying cash for a home, an appraisal is not required, but may be helpful to you in the process. Discuss this with your agent to determine if an appraisal is the right thing given the situation.
Once the appraisal is completed, if the value of the appraisal is lower than the agreed-upon purchase price, your Real Estate Agent will guide you through the process of dealing with that.