If you are using your neighbour's wifi, the password may be needed because unless they are philanthropic, they won’t keep their network open. If you are trying to connect to wifi from a restaurant or cafe, there also a password might be needed.
Sometimes these places also place the wifi password on a wall for everyone to see. If you find a password at such places, you can politely ask them to provide you with it.
The only place where you won’t need wifi is in open public or government-sponsored connections. Usually, these connections are open to everyone and keeping them password protected negates the whole motive of having a public connection in the first place.