How does an hydraulic ram pump work? Hydraulic ram (wikipedia)(youtube) uses the water hammer (wikipedia) to pump water.
Please help me understand how it works.
I understand that the check valve catches the pressure from the water hammer (since when the pressure below the valve is higher then above it, it opens)
What i do not understand is why does the waste valve open (and close)? (and how does it sync with the check valve?)
I guess it has to do with the air chamber (I do not exactly understand what is it for), but I do not understand why does it open?
Images are from here
 

 A: I doubt if the person who made that animated gif knew how the pump works. It's not at all clear why the valves open and close, and the regular movement of the water is nothing like an actual ram pump. It's more likely to confuse than enlighten people imo. 

This one (found on http://www.meribah-ram-pump.com) does a better job showing the strong waterhammer pulse. 
The waste valve can be a spring-operated normally-open valve that closes when the flow velocity generates sufficient drag.  The water in the drive pipe, which is long and rigid (steel pipes will generate higher pressure than pvc), has gathered significant momentum (p=m*v) by that time. 
When the valve closes, that momentum generates pressure, slamming open the check valve and compressing the air in the reservoir. The check valve closes again, the compressed air expands, pushing water up the delivery pipe. The waste valve reopens and the process repeats.
The air reservoir stores the energy, absorbs the pressure pulses, and provides continuous flow at the delivery pipe. It's comparable to a smoothing capacitor: can handle any incoming current, absorbs voltage (pressure) peaks, and delivers the energy during the whole cycle. Without the air, every time the waste valve closes, the two water columns are in direct contact, one at full speed, the other at rest. That will cause either large pressure peaks (when they meet head on), or large movement of the pump. At 30,000 times a day, they may not last very long.  
But the fundamental difference between a pump with air reservoir and one without is the efficiency: without reservoir, energy is transferred by a perfectly inelastic collision: the water in the drive pipe and the water in the delivery pipe have the same velocity after the collision. Not only is that the collision where most energy is lost, the mass in the drive pipe is  also the largest mass, and will keep most of its energy after the collision. 
With a reservoir, most of the energy of the drive mass is transferred to the reservoir, and all that energy is used to pump the water in the delivery pipe. 
A: 
what i do not understand is why does the waste valve open (and close)

The waste valve is normally open.  In your figures, the plug is weighted and falls away from the valve.  The water flow through the waste creates drag which pulls the valve closed.  

and how does it sync with the check valve?

When the waste valve closes, it causes the pressure in the lower vessel to rise dramatically, forcing water through the check valve.  The air chamber isn't strictly necessary from a physics point of view, but acts as a shock absorber and should improve the performance.  
A: 
i understand that the check valve catches the pressure from the Water hammer

that is correct

what i do not understand is why does the waste valve open (and close) 

the water hammer opens and closes the waste valve (see bellow)

(and how does it sync with the check valve?)

it does not sync, (the waste valve opens and closes without relying on the check valve)

i guess it has to do with the air chamber (i do not exactly understand what is it for), 

the air chamber is not for opening the waste valve but to capture as much of the pressure of the water hammer as possible

but i do not understand why does it open?

it opens because of low pressure caused by the water hammer (see bellow) 

the way i understand that it works (hat tip to @BowlOfRed for helping me think)  
that you create a perpetual water hammer using only one check valve (see below)
 (i do not know exactly how it works and i see that it is possible to stop (videos of closed valve) and stopped valve)  
and then you can just add a check valve with an air chamber for the pressure created by the water hammer a water hammer creates a bump of pressure to all go through it and not back to the water source since it is easier to compress the air then to go to the water source  

how a perpetual water hammer works 
see video 1 of diagram of the pressure of the water hammer and they bring an analogy of a train stopping video 2 (later in the video they explain the calculations) that after the stop it goes backwards  
so if there is a check valve at the end of a pip (coming from a reservoir of water (which is higher then the valve))
1. check valve is open,
2. and it closes when the water goes through it at a certain speed,
by closing
3. it makes the water speed 0.
4. which creates a water hammer
5. which pushes the water back  and (lowers the pressure).
6 which then opens the check valve
7. which lets the water out again
8. until it reaches the certain speed (then back to 2).  
(for some reason (i do not fully understand yet) it can also not open even when the speed is 0 see the first 2 links (1 and 2))

from this video it seems that the size of the waste valve will not change anything

edit
the reason why the valve can close is that the pressure of the water in the pipe (without the Water hammer) is enough for the valve to close,  
so it should always be closed
what opens it is the very low pressure after the Water hammer as it can be seen in this video that after the Water hammer the pressure is so low that the water starts turning into gas,
but the reason the valve stays open until the amount of speed/pressure is reached that it should close is because of gravity (pulling on the flapper in the valve) 
