How to use the timer on a Nikon D40?

How do I use the timer on a Nikon D40?

Have you read your owner's manual? If not, why not. Details wait for you there.

Look on page 32, 33 and 77, 79 of your user manual

It is all in your manual. Read it. It explains everything.

Much as I would love to order a D7000, I only have my little D40 but it's a fantastic camera for the money. I even bought a book about using it (after I'd read the manual which came with it)
… But probably the best guide I've read on the D40 is Ken Rockwells. It's full of stuff the official manual doesn't tell you.
Hope that answers the question.