Pitch is determined by the frequency of a wave, and frequency is the combination of wavelength and speed at which the wave is traveling. Sound has a constant speed of 343 meters per second, so wavelength dictates pitch. The longer a sound's wavelength, the lower the pitch of that sound.
When multiple instruments play the same pitch, the wavelengths they emit are the same length. Different instruments have different overtones, which are frequencies higher than the fundamental frequency of a sound. These overtones create the variation in sounds from instruments playing the same pitch.
Sound waves also have different amplitudes. Amplitude, or height of the peak of a wave, determines how loud a sound is, but it does not change the pitch.