UI UX is a field of computer science that goes deeper than just making nice looking web pages or apps. Yes, UI UX aims to capture users’ attentions, however, this is done through meticulous application of various psychological principles.
When you enter a site, what makes you want to stay on, more so than other sites offering the same services or offering the same information? Clean visuals, interactivity, modern design, etc. Well, these are achieved through psychology.
While visuals such as neuromorphism, glass blur effects, clean colour palettes, etc, do help in keeping you on the site for longer, there are much more subtle differences that web and UI UX designers apply as well. Small differences such as the padding of a button being 2 pixels rather than 4, is considered with importance and precision.
There is also in depth consideration of the feelings that the design invokes. This can mean that UX designers will consider visual and sensory perception, mental context switches, triggers, etc. These are conscious and subconscious decisions that affect how long, or how much you engage with that site or app. This can culminate in whether you decide to purchase a product, or subscribe to a service or email advertisements. UI UX designers accordingly alter their design decisions to try to alter your conscious and subconscious decisions.
Once a website has captured your attention, that is not work finished for UI UX designers. Once you have responded to a call to action, whether you are buying a product or registering for a service, you will go through a process to do so. To ensure that you commit to carrying out that process to the end, designers apply various decisions and psychological principles to simplify the process and make it intuitive overall. By reducing any chance of confusion, or visual and mental clutter and information overload, you will be more likely to complete the task.
To look at specific examples of the various psychological principles, Laws Of UX has a wide range of principles.