The recurrence has two cases based on whether the endpoints match. If s[i]=s[j]: Both characters can extend a palindrome. Look at dp[i+1][j−1] (the inner substring) and add 2.
So dp[i][j]=dp[i+1][j−1]+2. If s[i]=s[j]: At least one endpoint isn't part of the LPS. Take the better of excluding s[i] or excluding s[j]: dp[i][j]=max(dp[i+1][j],dp[i][j−1]). Notice the dependency: dp[i][j] needs dp[i+1][...] and dp[...][j−1]. These are shorter ranges. Iterate by increasing interval length so subproblems are ready.