Two different questions
Past simple answers "when did it happen?" Present perfect answers "what''s true right now, because of the past?"
"I lived in Lagos for five years" (past simple) states a finished period — you don''t live there now, or you''re about to say when it ended. "I have lived in Lagos for five years" (present perfect) states an ongoing situation that started in the past and continues now.
The quick test
If the sentence needs a specific past time word — yesterday, in 2019, last week, when I was a child — use past simple. If it needs "for", "since", "already", "yet", "ever", or "just", use present perfect.
"I have visited Paris three times" (no specific time — present perfect). "I visited Paris in 2019" (specific time — past simple). Mixing these ("I have visited Paris in 2019") is the single most common error at this level.
Practice
Write five sentences about your own life: one with "since", one with "for", one with "yesterday", one with "already", one with "when I was young". Check each one against the test above before you write it.