Like most applications of this type, sed doesn't modify the file itself by default, but you can add the -i option to do so.
The basic format of a sed command is this:
sed [options] (-e)[address range][expression] (-e [address range][expression])
The address range tells sed which lines to operate on. It can be a single number for one line, or number1,number2 for a range of lines. There's also $ to mean the last line and a few more modifiers.
sed -i '$ s/a/b/g' #changes all a's to b's on the last line of the file,
#modifying the original.
sed '5,7 d' #deletes lines 5-7, but only in the screen output.
sed -n '5,7p' #prints only lines 5-7 from the file.
sed '10 a foobar' #adds "foobar" after line 10.
sed can do a lot more than most people realize.
Here are a few useful references: