There is a couple of things it can be. The chosen authentication doesn't match the routers setting or the password is incorrect with an incorrect lower or higher case character or digit (also be aware whitespace is considered as a valid character). Sometimes the Wi-Fi cache works better if you 'forget' the previous setting completely on the receiving device (the Samsung) and try to create a new connection it sometimes works.
Essentially you want to choose WPA2 mode (auto) and avoid using WPS as it allows you connect wirelessly on the fly, so not the best for security.
It's a complicated subject but in principal it's all about radio channels, encryption and broadcast frequencies (2.4Ghz or 5Ghz).
My answer might seem over the top but I think understanding to some degree how something is meant to work solves at least 50% of the problem.
Track usage, upgrade and get support with the My O2 appDownload My O2