We use bothrightandrightlyas adverbs, but they are used in different ways and with different meanings.
Rightis an adverb of manner. It means ‘correctly’ or ‘well’:
The calculation was wrong first time, but I did itrightthe second time.
Not: …I did it rightly…
When everything goesright, no one says thank you, but when things go wrong, they start complaining immediately.
We userightlyto give an opinion or viewpoint on something. It usually comes in the normal mid position for adverbs (between the subject and the main verb, or after the modal verb or first auxiliary verb, or afterbeas a main verb). It means ‘in the opinion of the speaker, in a morally correct way’, and is more subjective thanright:
Herightlytook the money he had found straight to the nearest police station.(In the speaker’s opinion, this was the morally correct thing to do.)
Climate change isrightlyseen as the greatest threat to the world at the present time.