Buffers are used whenever you need... well... a buffer. As in the literal meaning of the word. They're used when you need to buffer the input from the output. There are countless ways to use a buffer. There are digital logic gate buffers, which are passthroughs logicwise, and there are analog buffers, which act as passthroughs but for an analog voltage. The latter is kind of outside the scope of your question, but if you're curious, look up 'voltage follower'.
So when or why would you use one? At least when the simplest and cheapest buffer of all, a copper wire/trace is readily available?
Here are a few reasons:
1. Logical Isolation. Most buffers have an ~OE pin or similar, an output enable pin. This allows you to turn any logic line into a tristate one. This is especially useful if you want to be able to connect or isolate two busses (with buffers both ways if needed), or maybe just a device. A buffer, being a buffer between those things, lets you do that.
2. Level Translation. Many buffers let the output side be powered from a different voltage than the input side. This has obvious uses for translating voltage levels.
3. Digitization/repeating/cleanup. Some buffers have hysteresis, so they can take a signal that is trying real hard to be digital, but just doesn't have very good rise times or isn't quite playing right with thresholds or whatever, and clean it up and turn it into a nice, sharp, clean-edged digital signal.
4. Physical Isolation You have to send a digital signal further than you like, things are noisy, and a buffer makes a great repeater. Instead of a GPIO pin on the receiving end having a foot of pcb trace connected to it, acting as an antenna, inductor, and capacitor and literally vomiting whatever the heck noise and awfulness it wants directly into that poor pin's gaping mouth, you use a buffer. Now the GPIO pin only sees the trace between it and the buffer, and the current loops are isolated. Heck, you can even properly terminate the signal now, like with a 50Ω resistor (or whatever), because you have a buffer on the transmit end too and can load them in ways you could never load a wimpy little µC pin.
5. Driving loads. Your digital input source is high impedance, too high to actually interface with the device you want to control. A common example might be an LED. So you use a buffer. You select one that can drive, say, a hefty 20mA easily, and you drive the LED with the buffer, instead of the logic signal directly.
Example: You want status indication LEDs on something like a I2C bus, but adding LEDs directly to the I2C lines would cause signaling issues. So you use a buffer.
6. Sacrifice. Buffers often have various protection features, like ESD protection, etc. And often they do not. But either way, they act as a buffer between something and another thing. If you have something that might experience some sort of transient condition that could damage something, you put a buffer between that thing and the transient source.
Put another way, chips love exploding almost as much as they love semiconducting. And most of the time, when something goes wrong, chips explode. Without buffers, often whatever transient that is popping chips left and right will reach deep into your circuit and destroy a bunch of chips at once. Buffers can prevent that. I'm a big fan of the sacrificial buffer. If something is going to explode, I'd prefer it be a 50¢ buffer and not a $1000 FPGA.
Those are some of the most common reasons I could think of off the top of my head. I'm sure there are other situations, maybe you'll get more answers with more uses. I think everyone will agree that buffers are terribly useful, even if at first glance, they seem rather pointless.
Best Answer
Let me begin the analysis of the CMOS gate Schmitt trigger circuit by assuming that we have an ideal CMOS gate. For a CMOS gate operating at a power supply voltage of 5V, the acceptable input signal voltages range from 0 volts to 2.5 volts for a “low” logic state and 2.5 volts to 5 volts for a “high” logic state.
The threshold voltage is at 0.5Vdd = 2.5V, therefore, the voltage transfer characteristic for our ideal inverter gates will look like this:
Now let us see how adding two resistors affected the switching threshold.
If the input is at LOW state the output is also at LOW.
But if we slowly increase the input voltage from 0V towards 5V and observed the situation we can see that for \$V_{IN} = 1V\$ due to the voltage divider action form by \$R_1\$ and \$R_2\$ the first gate see only \$V_X = 1V \frac{R_2}{R_1 + R_2}= 0.9V\$ at his input (2.5V is needed to swich the gate state).
So we increase the input voltage further to \$V_{IN} = 2.5V\$, but again the voltage at the input (Vx) is to low \$V_X = 2.5V \frac{R_2}{R_1 + R_2}= 2.27V\$ to change the gate state.
The input voltage needs to be greater than \$V_{TH1} = (\frac{2.5V}{10k\Omega} * 1k\Omega)+ 2.5V = 2.75V\$ to gate to switch his state from LOW to HIGH.
Hence the Threshold Voltage (from LOW to HIGH) is equal to \$2.75V\$
Also, notice that now we have a HIGH state at the output (5V) and \$2.75V\$ at the input and the voltage at the gate input (Vx) is equal to \$2.95V\$.
Hence, a further increase in the input voltage will do not change anything in the circuit.
And this is all possible due to the positive feedback and voltage divider.
Because even if the second gate slowly increases his input voltage from 0 to 5V. Positive feedback via R2 speed up this process.
To see how it is done I "freeze" switching the process.
The input voltage reaches \$2.75V\$ and the first gate "see" \$2.5V\$ at his input (Vx) and the switching process begins, the output voltage of a second gate starts to increase his output voltage from 0V to 5V. And if this output voltage reaches \$1V\$ the \$V_X\$ voltage will increase to \$2.59V\$ and it will further increase as the second gate output voltage increases. The input voltage does not need to increase any further, but the \$V_X\$ voltage will be increased "automatically" via R2 resistor due to the second gate change his state from LOW to HIGH. And this is the positive feedback.
As you can see to change the output voltage from HIGH to LOW the input voltage needs to start decreasing his value:
As you can see the input voltage must drop below 2.25V to change the situation. Therefore the second threshold voltage is equal to \$2.25V\$ (change from HIGH to LOW )
And the voltage transfer characteristic will look like this:
The blue color corresponds to the situation when \$V_{IN}\$ grows from 0V to 5V.
And the red color when \$V_{IN}\$ decreases from 5V to 0V.
And as you can see in the attached picture we have a beautiful hysteresis.
And the width of this hysteresis is equal to
$$ΔV_H = 2.75V - 2.25V = \frac{R_1}{R_2}\cdot ΔV_{OUT} = \frac{1k\Omega}{10k\Omega} 5V = 0.1\cdot 5V = 0.5V$$