A share is a piece of a business. Like being a co-owner of a coffee shop: if the year went well, you get paid part of the profit. This payment is called a dividend. It goes to those who owned the share by a certain day — the company announces that day in advance.
You already know how stocks behave from earlier courses: trading only during the exchange's working hours, jumps after weekends and reports, sometimes by 5–10% overnight.