You may think, that I've put this lesson in the wrong category, but before you start developing a negative mindset, allow me to explain myself.
For a beginner, a simplified version of a lesson may sometimes more benefit than a regular one. That's why this lesson is put here.
Anyway, enough chit-chat. Time to learn.
In general, there are 2 ways in which people write songs.
No.1 "Lyrics first, music second"
This way lyrics get written beforehand, and the music (guitars, bass, drums, etc) only after.
Often, people consider this as the safest/best/easiest way to write a song, because then, you don't necessarily have to stick to only one mood, and when you have the lyrics ready, you know what they are written about, and you already have at least one musical "mood" that would fit them 100%.
No.2 "Music first, lyrics second"
This way music gets written first, and lyrics get written later.
Sometimes a riff (or any other musical motif) may come to your head without having any lyrics to it, and you may make a full song without any lyrics, and only then start thinking about what lyrics to add to it.
A lot of musicians consider this way of songwriting harder, because then you (kinda)HAVE to write lyrics in an already chosen musical "mood", and sometimes your mind is going in the opposite direction (having a different mood, not wishing to write any lyrics, and so on), and you can't really write the lyrics.
As you have noticed, these 2 ways deal with songs that have lyrics.
But, there are also songs without lyrics (Or vice versa).
Songs of this kind are called instrumentals (Or a-capella, if you are dealing with a song that consists only of lyrics).
Despite some differences, these ways have some general things in common, which are the basics of songwriting.
The writing of lyrics;
Choice of scale (key) for the song (you may implement more than one in 1 song);
Composition of the music.
Now, let's talk about how to do it.
Whatever way you choose, there are some common steps you have to take:
1. Gather everything that is necessary (things like your instrument, paper, pen, recording stuff, maybe also a drink, or a snack) for you in a place where you feel you REALLY can do your work. It can be any place.
2. Make sure you don't get disturbed much.
3. Choose a genre for the song. You can choose more than one (Actually, by mixing genres, and experimenting with them, you may get an interesting result).
4. Decide, what you want to write about (unless an inspiration regarding some particular subject has already hit you).
5. Ask yourself: "What mood do I want to create?"
You may do it the traditional way, when the mood fits the lyrics.There are tons of examples, I suggest you to start looking at all that from the 80's stuff, because it's great stuff. Great riffs, great solos, and the lyrics are good as well(even some of the cheesy ones)
Or also, you can have sad/pessimistic lyrics, but choose a rather happy musical "mood".
A fine example of that is "Hypnotize" by S.O.A.D.
6. While writing, make sure that the singer (be it you, or your bandmate) will be able to pronounce the lyrics while singing.
7. Think a little about approximately, how long would you like the song to be. Consider the number of parts for the song. Ya know, like how many verses, guitar/bass solos, bridges, and how long do you want them to be, where would you like to put each one of them...
8. Pick a chord progression for each part of the song. Often Verses, and choruses have different chord progressions/riffs, the rhythm guitar-riff for guitar solo may sometimes differ from the riff for the chorus ("Round And Round" by RATT is a good example).
9. Apart from writing your ideas down, it is a good idea to record them somewhere. So grab your microphone(any will do the trick, if it's in working condition), plug it in, and record your ideas (You will also need either a computer with a program for recording, either a multi-channel recorder).
10. If you have bandmates, show your work to them, see what they say about it, and talk about it with them. It needs to be done, because, they will have to play the song too.
They may not like your work, but if it is unfinished, and they DO like it, then they probably will help you to finish it.
If you have a band, then you probably have already chosen a genre to play in, and if so, think twice about the genre of the song, because if you write the song in a completely different genre, then your work (even if it is really good) is more likely to be rejected by your bandmates.
As always, I hope you have gained a lot from this lesson. KEEP ROCKIN'!