Illustration can be used in UI to tell a story, explain content, or visually break up content that may be very text heavy. Icons and illustration should serve a purpose, an are primarily used in UI to convey a message and help guide a user through the interaction experience with ease.
Illustration should be:
Meaningful
Recognisable
Attractive
Consistent
Illustration can be used in the onboarding process of signing up to a new app, as this makes the process easier for a new user to follow. This is because images are easier and quicker for the human brain to process and understand.
Tumblr uses illustrations in the background of onboarding process to greet new users. I think this is very well executed as the art is always from Tumblr users; allowing new users to get an idea of what they can expect to see when they sign up for the site.
Duolingo is an excellent example of illustration used well in UI. Duolingo is a language learning app, and it uses illustrations to aid the user in their learning process. Each unit is laid out like stepping stones, interspersed with illustrations of chests and gates etc- indicating progress. You are also able to customise your own Duolingo character stylised avatar.
When you complete a lesson quickly, you are rewarded with an illustration of characters celebrating. There are elements of animation incorporated here also, for extra effect. This kind of positive pictorial feedback is designed to make the user feel rewarded, and encourage their further learning.
There are no photographs on the Duolingo app at all. all of their imager are in their own specific style of illustration, even including their icons- which are a bit more detailed than typical navigation icons.
Illustration is not just for decoration and to enhance the aesthetics of an app, but also to enhance the user experience. Illustrative styles must also must fit the brand of an app to allow for a cohesive and professional look.