To change the keyboard layout on a Raspberry Pi, do the following:
Sometimes when you pressed a wrong keyboard combination, it is possible that your keyboard layout changed from azerty to qwerty or from qwerty to azerty. Mostly you don’t know how you changed it and how you change it back to your original layout. To do so, press alt + shift and you changed back your keyboard layout. Enjoy!