1 Peter 3:17 For it is better to suffer for doing good, if that should be God’s will, than for doing evil.
The “how” of knowing God’s will is most easily summed up by discussing prayer and reading God’s Word. The “why”, however, is really the more difficult to fathom. It isn’t enough to say “because God says so”. Ultimately, that is enough because He is God and we ought to follow His commands, but the answer doesn’t satisfy us deeply. We want to know why God has something specific in mind for us to do.
God’s purpose in all things is to bring glory to Himself. That, to some, sounds very selfish and gives reason NOT to follow God’s will if He’s just going to be doing whatever He wants for His own attention. They’d say, “If I acted that way, people would think I was completely arrogant and selfish and they’d want nothing to do with me”. Yes, that’s true…but you’re not God. You’re flawed and make all sorts of mistakes. And when you want personal glory, it’s for the wrong reasons and without just cause. God though, God is perfect and holy. He deserves the glory and when He gets it, it’s for the right reasons. It actually benefits us for Him to receive glory, it’s not just selfishness.
In fact, it’s better for us to suffer if it’s God’s will, than to do whatever we want if it’s not. He has the best intentions in mind for us and knows exactly what we need. He’s sovereign, but He’s good. He’s not out to get us like some crazed egomaniac that will stop at nothing to see Himself worshipped. He cares for us and loves us and that’s all considered as He wills certain things to take place.
Why should we do God’s will? Because He knows better than us.