IR rays over carrier frequency of 34Khz?
There are two different frequencies, in two entirely different contexts, involved.

The infrared light generated by an infrared LED is in the 300+ GHz range, this is correct. For instance, the TSAL5400 IR LED often used in remotes has its radiation peak at 940nm wavelength, i.e. 318,930 GHz. 



However, IR remote controls do not output continuous infrared light. The LED output is "chopped" via control circuitry into pulses of a given frequency, such as 34 KHz, 38 KHz, 40 KHz or 56 KHz.

The IR sensor at the other end filters incident IR at the specified frequency, and ignores any IR that does not conform to this chopping frequency or modulation. This ensures that stray infrared light, such as from sunlight, heat sources, or incandescent lamps, is ignored by the sensor, and only the correctly modulated incoming IR is acted upon. 



This block diagram illustrates the operation of the classic, and now obsolete, TSOP17xx family of IR receivers, with the bandpass stage shown. This part, for instance, offers the following versions by chopping frequency:


TSOP1730 30 kHz  
TSOP1733 33 kHz 
TSOP1736 36 kHz  
TSOP1737 36.7 kHz
TSOP1738 38 kHz  
TSOP1740 40 kHz 
TSOP1756 56 kHz


There are multiple different such chopping frequencies supported by standard IR sensors for remote controls, so that two different remotes do not interfere with each other.

The above chopped (modulated) IR signal is further switched on and off in a binary pulse stream, to convey the actual remote control commands, of which several different standards exist. That goes beyond the current question, a bit of searching will provide additional information.



UPDATE: Adding an analogy to explain the concept of how this all works...

Consider several pairs of people standing on opposite sides of a deep valley. People on the north side have bright green flashlights, with which they are to signal their respective partners on the south side.

In order to make sure that each south-sider only bothers with signals from their own partner on the north side, ignoring everyone else, each pair decide on a flashing (strobe) frequency... The first pair agree upon a pattern of 5 flashes a second. The second pair decide on 11 flashes a second. The third pair, 17 flashes a second... and so on.

Now, if the first south-sider sees a green light flashing at 5 flashes per second, they sit up and pay attention. If the flashing is more rapid, or less, they ignore it.

Next: How does the north-sider communicate a specific message over to the south-side partner? Merely indicating that they exist, by flashing their light at the agreed upon frequency, is not enough. So they agree upon Morse code, with a dash being 2 seconds of activity, a dot being 1 second of activity, and gaps of half a second between each two symbols.

So, to send the letter "D", the first north-sider flashes the light 5 times a second, for 2 seconds, then a gap, then again flashes for 1 second, then a gap, then another 1 second, then stops.

On the other side, everyone except the partner of the first person ignores the flashes, since they flash rate is not their agreed 11 or 17 flashes a second. The first partner however picks up the "D" message. Everyone looks up their Morse code reference booklets, and the game continues.



In this analogy,


The green flash light is like the infrared itself - its spectral composition (electromagnetic wavelength) is irrelevant to both parties, other than merely that it is visible to the other side, the sensor.
The 5 or 11 or 17 strobes a second are the "baseline modulation", like the 34 or 38 KHz.
The durations of 1 or 2 seconds that the flashing is done, for each symbol, are like the code modulation Drummond referred to. During the 1 second "high" period, the flashlight is rapidly strobing, at the previously mentioned flash rate. During the "low" period, all is dark - or others up north could be flashing their lights at 11 or 17 times a second, which is of no interest to south-sider #1.
The Morse code protocol mentioned above is the equivalent of the Sony or other remote control protocol used by your TV.
The person on the north is the sending microcontroller, their partner on the south is the TSOP1738 sensor.


I hope this makes things a bit clearer. If not, someone else will have to try explaining.