(1) I learn to be smart. = I learn in order to be smart.
(a) Why do you learn?
(b) to be smart.
(i) infinitive phrase modifies "learn." = I learn in order (for me) to be smart. The infinitive phrase is adverbial.
(2) It has proved to be invaluable.
(a) What has it proved to be?
(b) "to be invaluable" is an adjective here. It refers to the subject ("It").