How to apply foundation

Whenever I use foundation it always gets cakey looking so I just stick to light concealer. I try primer, wetting my beauty blender, foundation brush, fingers, and setting spray. What am I doing wrong? I see pictures of raw photos of other girls having a smooth finished look after they’re done with their foundation but I get a cakey look, what should I be doing?