Sender ID Framework (SPF) is the DNS protocol for nominating servers that can send email on behalf of your domain name.
When using Office365, it is recommended that you setup an SPF record so that the Exchange Online servers can send email on behalf of your domain. The standard record will only allow the Exchange Online servers send email on the domains behalf.
However if you are in transition and still have on premise SMTP servers or you have 3rd party tools (mass emailers) that send email on behalf of your domains you will need a more complex SPF record.
Thankfully, Microsoft has a pretty good online wizard/tool for creating SPF records for a specified domain, taking into account Exchange Online Protection and existing MX records.