In order to stream to Twitter, you will need access to Twitter's Media Studio.
To begin, visit https://studio.twitter.com/producer/broadcasts and click on the Sources tab.
Click Create source.
For source type, choose RTMP.
Enter the required fields:
Source name (whatever you would like to call your stream)
Region (select the region that is closest to your stream origin location)
Once created, click on the source and retrieve your Stream Key and Stream URL.
Once this information is entered, make sure the toggle is enabled and you are ready to go live!
The stream will now initiate once the recording button has been selected in your studio.
For more information, please visit https://help.twitter.com/en/using-twitter/how-to-use-live-producer#RTMP