How did the beatitudes came to be?

Can you answer this question?