Maybe this will help.
Assume forward motion. When you turn the bike, it does not stay upright and perpendicular to the horizontal surface, it leans. There are now lateral forces that push the bike's center of gravity vector away from vertical but at an angle so the down force is still more or less under the tire contact patch. To maintain the lean angle the front wheel will be turned in the direction of the turn so that the lateral forces maintain the CG over the tire contact patch. But, how did we get into the lean and how do we get out of the lean?
Try to visualize where the center of gravity is on the bike with mounted driver. It is some point between tire contact and rider's brain. So, let's say there is a line drawn fore and aft at the center of gravity you visualized. If the bike were stopped and laid over horizontal, it would balance and be stable with a fulcrum on this line. If you pushed down on the rider's brain, the wheels would come up, and vise-versa.
Counter steering does the same thing while riding. If you want the riders brain to go right into a lean the front wheel is initially turned left to pivot that bike about the CG until it reaches the lean angle required for a stable turn. Then the front wheel is turned to the right to maintain the turn. If you forced the wheel straight while in the turn the lean would increase until...ouch. To recover from the leaning turn, the front wheel is turned deeper into the lean. The wheel track forces the bike to pivot around CG forcing the bike into a more vertical position.
The front steering geometry (rake and trail) determine how neutral the steering is while upright and leaned over. But, pushing or pulling on the bar ends change that balance. Try it while in motion. Momentarily push on the right bar feel the weight shift and find the leaning in a right turn . You can counteract the turn by shifting rider weight left while pushing on the right bar. This, of course, moves the CG. The demonstration is more effective if the rider maintains a rigid position on the bike.
Initial counter steering can be used to quickly get into a leaned over tight turn. And, also to straighten up rapidly.