In order to be funny you need to see things from a different angle, or perspective. Take an everyday object and see it differently. Like in this photo.
These are ordinary objects seen differently to produce humour. If you want some practice try describing one of those scenes.
Written humour works differently from visual humour, but still has the same rule, see it from a different perspective. For instance:
A man walks into a bar. Ouch!
The hardest thing you can attempt is to make a serious scene funny. You have to write it as humour from the start or you'll end up getting yourself into a mess.
Of course, some humour won't travel very well. Things that are humourous to one person will leave another person scratching their head. British comedians don't necessarily do well in the USA and vice versa. Jokes about London only tend work if you live or work there, while those about Big Brother only work if you know what it is.
So how do you write humour? Stand back and look at something from a different angle. If you want to see how it's done, read some of the greats. Terry Pratchett, Tom Holt, Neil Gaiman and Douglas Adams, or hunt around the bookshop and see what they have. Alternatively, watch a few TV shows and films.
Above all, write what makes you laugh. If you're not laughing, I guarantee no one else will.