While within warcraft, type /macro

You have to name the macro, but whatever you name it is irrelevant.
I usually select the red questionmark as the icon, as that will change to use the correct icon for the spell that is currently being cast.
However, you can force it to display any icon you wish.
Press Ok when done.

Now you have the macro text box.

The first line of the macro is optional.
You can omit it, or go with #show or #showtooltip
#show will display the icon only, and if you want you could use #show Arcane Shot, even if the macro does not do arcane shot... it has to be a spell/ability your class gets.
#showtooltip will display the icon and tooltip on mouse over.

I sometimes like to do things like:
#show Elemental Mastery
/castsequence reset=5 Flame Shock, Lavaburst, Chain Lightning, Frost Shock
Which uses the DPS castsequence as a timer for the Elemental Mastery spell, even though its not part of my sequence.

Once you get past the #show line, you have the actual macro.
/Cast is one spell, while /Castsequence is a chain of spells.
Reset=1 (or any other number) means it resets to the start after that many seconds of not being pushed has occurred.
You can also use Reset=Combat, which resets when you leave combat, or Reset=Target which resets when you change targets.