The reason the horn may work sometimes is because of poor contacts or wiring in the steering wheel. There could also be a problem with the horn relay or its wiring.
this is what ould be wrong with your car horn. there is a lose wire somewhere arounf where your horn connects too. or a fuse is lose or blow that you need to change