The concept of pyramid wavefront sensors (PWFS) has been around about a decade by now. However, there is still a great lack of characterizing measurements that allow the best operation of such a system under real life conditions at an astronomical telescope. In this article we, therefore, investigate the behavior and robustness of the pyramid infrared wavefront sensor PYRAMIR mounted at the 3.5 m telescope at the Calar Alto Observatory under the influence of different error sources both intrinsic to the sensor, and arising in the preceding optical system. The intrinsic errors include diffraction effects on the pyramid edges and detector read out noise. The external imperfections consist of a Gaussian profile in the intensity distribution in the pupil plane during calibration, the effect of an optically resolved reference source, and noncommon-path aberrations. We investigated the effect of three differently sized reference sources on the calibration of the PWFS. For the noncommon-path aberrations the quality of the response of the system is quantified in terms of modal cross talk and aliasing. We investigate the special behavior of the system regarding tip-tilt control. From our measurements we derive the method to optimize the calibration procedure and the setup of a PWFS adaptive optics (AO) system. We also calculate the total wavefront error arising from aliasing, modal cross talk, measurement error, and fitting error in order to optimize the number of calibrated modes for on-sky operations. These measurements result in a prediction of on-sky performance for various conditions.