TLDR:
His goal was to release Lucifer, which required breaking the Seals. To do this, he needed two things. Firstly, he needed to raise Lilith, as her death was the final scene. Secondly, he needed to raise a vessel for Lucifer to possess when he was finally released.
Long Answer:
In the Season 4 finale, Lucifer Rising, we see Azazel possessing a priest in 1972 and arriving at St. Mary's Convent. He slaughters eight nuns there and, using a dead nun, is able to speak directly to Lucifer. He tells him he has done this to speak to him, to help free him:
AZAZEL Father, look... I'm not exactly the praying type, but still...
I made the sacrifice. I got you a bagful of nuns. So, uh... can you
hear me? Can you whisper through the door?
DEAD NUN CHANNELING LUCIFER
(in distorted gender-ambiguous voice) I'm here, my son.
Lucifer however, tells him that 66 Seals need to be broken that hold him captive - and that only Lillith can do this. However, he is told to find Lucifer "a special child":
AZAZEL So, uh... how do I bust you out?
LUCIFER Lilith.
AZAZEL Lilith?
Father, she's... trapped neck-deep in the pit. It won't be easy.
LUCIFER Lilith. Lilith can break the seals.
AZAZEL Yeah, okay. But
what do I do?
LUCIFER You must find me a child. A very special child.
AZAZEL (Eyes flash yellow) What do you mean? What child?
So at this point, his plan is starting to become clear. He needs to get Lilith out of whatever pit she is in and he needs to find Lucifer a special child.
With regards to the "special child"
Azazel then begins to go around the country and make deals with parents, allowing him to feed his blood to their babies later and make them develop supernatural abilities. Their abilities were strengthened depending on how much demon blood they consumed (as Sam's demise throughout Series 4 showed).
All in all, these were all the known "special" children (taken from the wiki):
- Sam Winchester
- Max Miller
- Andrew Gallagher
- Ansem Weems
- Ava Wilson
- Jake Talley
- Lily Baker
- Scott Carey
More information on them can be read on the linked wiki page. Whilst we originally saw their powers grow, the conversation from the Season 4 finale revealed their true purpose definitively - they were all potential vessels for Lucifer. Azazel had them battle at the end of Season 2 to find out who was the strongest (and thus most worthy) of the honour.
With regards to Lilith
Lilith is a little complicated to get into detail on, as the reason for being in the pit isn't explained on the show. When Sam kills her, this exchange does take place though:
SAM (in denial) No, no, no. No, he -- Lilith -- I stopped her. I
killed her!
RUBY (fervently) And it is written that the first demon
shall be the last seal. And you bust her open...
In other words, she was the first demon - the first ever. She was created by Lucifer himself. Whilst this doesn't explain why she is buried in the pit, this tallies with the real-world religious sources on Lilith, where she is regarded as one of the first demons (and in some sources, she's even considered one of the wives of Adam).
Conclusion
Azazel's ultimate goal was to release Lucifer. To do this, he needed two things. Firstly, he needed to raise Lilith, as her death was the final scene. Secondly, he needed to raise a vessel for Lucifer.
Ultimately, given his demise in Season 2, we never saw the power dynamic between himself and Lilith. However, the Companion Series for Supernatural does describe that the white-eyed demons were the highest rank there could be, so it seems likely she would outrank him.